Documentation
¶
Overview ¶
Package constraints defines a set of useful constraints to be used with type parameters.
Index ¶
- type Basic
- type Comparable
- type Comparabler
- type Complex
- type Float
- type Integer
- type Integer64
- type IntegerNo8Bit
- type Number
- type Ordered
- type Orderer
- type Real
- type Real64
- type Signed
- type Signed64
- type SignedNo8Bit
- type Sortable
- type Sorter
- type Text
- type Unsigned
- type Unsigned64
- type UnsignedNo8Bit
- type UserSorter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Basic ¶
type Basic[O Ordered] struct{ Val O }
Basic is a parameterized type that abstracts over the entire class of Ordered types (the set of Go built-in types which respond to < <= >= > == != operators) and exposes this behavior via methods so that they fall under the Orderer constraint.
func (Basic[O]) EQ ¶
EQ implements Orderer[Basic[O]] for Basic[O]. Returns true if the value of the caller is equal to that of the parameter; otherwise returns false.
func (Basic[O]) GE ¶
GE implements Orderer[Basic[O]] for Basic[O]. Returns true if the value of the caller is greater than or equal to that of the parameter; otherwise returns false.
func (Basic[O]) GT ¶
GT implements Orderer[Basic[O]] for Basic[O]. Returns true if the value of the caller is greater than that of the parameter; otherwise returns false.
func (Basic[O]) LE ¶
LE implements Orderer[Basic[O]] for Basic[O]. Returns true if the value of the caller is less than or equal to that of the parameter; otherwise returns false.
type Comparable ¶
type Comparable interface{ comparable }
Comparable is an interface that is implemented by all comparable types (booleans, numbers, strings, pointers, channels, arrays of comparable types, structs whose fields are all comparable types). The Comparable interface may only be used as a type parameter constraint, not as the type of a variable. If future releases of Go add new comparable types, this constraint will be modified to include them.
type Comparabler ¶
type Complex ¶
type Complex interface { ~complex64 | ~complex128 }
Complex is a constraint that permits any complex numeric . If future releases of Go add new predeclared complex numeric types, this constraint will be modified to include them.
type Float ¶
Float is a constraint that permits any floating-point type. If future releases of Go add new predeclared floating-point types, this constraint will be modified to include them.
type Integer ¶
Integer is a constraint that permits any integer type. If future releases of Go add new predeclared integer types, this constraint will be modified to include them.
type Integer64 ¶
type Integer64 interface { Signed64 | Unsigned64 }
Integer is a constraint that permits any integer type 64 bits in size. If future releases of Go add new predeclared integer types, this constraint will be modified to include them.
type IntegerNo8Bit ¶
type IntegerNo8Bit interface { SignedNo8Bit | UnsignedNo8Bit }
IntegerNo8Bit is a constraint that permits any integer type larger than 8 bits. If future releases of Go add new predeclared integer types, this constraint will be modified to include them.
type Number ¶
Number is a constraint that permits any real or complex number type. If future releases of Go add new predeclared real or complex types, this constraint will be modified to include them.
type Ordered ¶
Ordered is a constraint that permits any ordered type: any type that supports the operators < <= >= >, as well as == and !=. If future releases of Go add new ordered types, this constraint will be modified to include them.
type Real ¶
Real is a constraint that permits any real number type. If future releases of Go add new predeclared integer or floating-point types, this constraint will be modified to include them.
type Real64 ¶
Real64 is a constraint that permits any real number type 64 bits in size. If future releases of Go add new predeclared integer or floating-point types, this constraint will be modified to include them.
type Signed ¶
Signed is a constraint that permits any signed integer type. If future releases of Go add new predeclared signed integer types, this constraint will be modified to include them.
type Signed64 ¶
SignedNo8Bit is a constraint that permits any signed integer 64 bits in size. If future releases of Go add new predeclared signed integer types, this constraint will be modified to include them.
type SignedNo8Bit ¶
SignedNo8Bit is a constraint that permits any signed integer type larger than 8 bits. If future releases of Go add new predeclared signed integer types, this constraint will be modified to include them.
type Sortable ¶
type Sortable interface { Ordered | UserSorter[Sorter] }
Sortable defines a sortable constraint that allows user defined sortable types.
type Text ¶
Text defines a text constraint that permits types that are often used to represent text streams.
type Unsigned ¶
Unsigned is a constraint that permits any unsigned integer type. If future releases of Go add new predeclared unsigned integer types, this constraint will be modified to include them.
type Unsigned64 ¶
Unsigned64 is a constraint that permits any unsigned integer 64 bits in size. If future releases of Go add new predeclared unsigned integer types, this constraint will be modified to include them.
type UnsignedNo8Bit ¶
UnsignedNo8Bit is a constraint that permits any unsigned integer type larger than 8 bits. If future releases of Go add new predeclared unsigned integer types, this constraint will be modified to include them.
type UserSorter ¶
type UserSorter[T Sorter] interface{ *T }