constraints

package module
v0.0.0-...-31dbb72 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0, BSD-2-Clause Imports: 1 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cloneable

type Cloneable[T any] interface {
	// Clone returns an exact copy of the object.
	Clone() T
}

Cloneable is a constraint that permits cloning of any object.

type Comparable

type Comparable[T any] interface {
	Compare(other T) int
}

type ComparableStringer

type ComparableStringer[K comparable] interface {
	Key() K
	fmt.Stringer
}

ComparableStringer is a constraint that returns a comparable type via Key() and a string representation via String().

type Complex

type Complex interface {
	~complex64 | ~complex128
}

Complex is a constraint that permits any complex numeric type. If future releases of Go add new predeclared complex numeric types, this constraint will be modified to include them.

type Equalable

type Equalable[T any] interface {
	Equal(other T) bool
}

Equalable is a constraint that permits checking for equality of any object.

type Float

type Float interface {
	~float32 | ~float64
}

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

type Integer interface {
	Signed | Unsigned
}

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 Numeric

type Numeric interface {
	Integer | Float
}

Numeric is a constraint that permits any numeric type: any type that supports the numeric operators. If future releases of Go add new ordered types, this constraint will be modified to include them.

type Ordered

type Ordered interface {
	Integer | Float | ~string
}

Ordered is a constraint that permits any ordered type: any type that supports the operators < <= >= >. If future releases of Go add new ordered types, this constraint will be modified to include them.

type Ptr

type Ptr[A any] interface {
	*A
}

Ptr is a helper type to create a pointer type.

type Signed

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

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 Unsigned

type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL