package
module
Version:
v1.0.11
Opens a new window with list of versions in this module.
Published: Jan 21, 2024
License: GPL-3.0
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
README
¶
typr
The typr
package has conventions, type definitions and constants
Documentation
¶
Package typr contains utility conventions, type definitions and constants
type Comparator[V any] func(e1, e2 V) int
returns:
- 0 if e1 == e2
- 1 if e1 > e2
- -1 if e1 < e2
an Operation type value
const (
Continue Op = iota
Break
)
type Pair[X, Y any] struct {
X X
Y Y
}
an envelope holding two values, each respectively of specified type
func (p Pair[X, Y]) Value() (r Pair[X, Y])
returns a copy of the the Pair
type Qualifier[V any] func(e V) (r bool)
returns bool true, if the specified element e "qualifies", and bool false, otherwise
type Ranger[V any] func(i int, e V) (r Op)
accepts an index and an element of the specified type, and return an Operation value
type Resolver[V, R any] func(v V) (r R)
returns the resolved value (as the specified type), for the specified value
type Trio[X, Y, Z any] struct {
X X
Y Y
Z Z
}
an envelope holding three values, each respectively of specified type
func (t Trio[X, Y, Z]) Value() (r Trio[X, Y, Z])
returns a copy of the Trio
type Validator[V any] func(e V) (r error)
returns a non-nil error, if the specified element e is considered invalid, and nil, otherwise
Source Files
¶
Click to show internal directories.
Click to hide internal directories.