Documentation ¶
Overview ¶
Package generic provides methods to test whether a type conforms to a generic interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // T1Ty is the type of T1. T1Ty = reflect.TypeOf(T1{}) // T2Ty is the type of T2. T2Ty = reflect.TypeOf(T2{}) // T3Ty is the type of T3. T3Ty = reflect.TypeOf(T3{}) // T4Ty is the type of T4. T4Ty = reflect.TypeOf(T4{}) // TOTy is the type of TO. TOTy = reflect.TypeOf(TO{}) // TPTy is the type of TP. TPTy = reflect.TypeOf(TP{}) )
Functions ¶
This section is empty.
Types ¶
type Match ¶
type Match struct { // Errors found matching the interface to the implementation. Errors []error // Bindings of generic type to matched type. Bindings map[reflect.Type]reflect.Type }
Match is the result of Implements and CheckSigs.
func CheckSigs ¶
CheckSigs checks that each function signature implements the generic interface signature. CheckSigs returns a Match which lists any generic type inconsistencies, and lists the mappings of generic types to implementation types.
func Implements ¶
Implements checks that ty implements the generic interface iface. Implements returns a Match which lists any generic type inconsistencies, and lists the mappings of generic types to implementation types. generics is a list of open types used by the generic interface iface.
type Sig ¶
type Sig struct { // Name of the function. Name string // The signature the function must match. Interface interface{} // The provided function being checked. Function interface{} }
Sig is a pair of functions used for validation by CheckSigs.