constraint

package
v0.0.0-...-02bf512 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package constraint defines useful constraints that are not in the go builtin package

SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BigOps

type BigOps[T any] interface {
	Abs(T) T
	Add(T, T) T
	Cmp(T) int
	Mul(T, T) T
	Neg(T) T
	Quo(T, T) T
	Set(T) T
	SetInt64(int64) T
	SetUint64(uint64) T
	Sign() int
	String() string
	Sub(T, T) T
}

BigOps is an interface that describes all the common methods of the provided go big types

type Cmp

type Cmp[T any] interface {
	comparable
	// Returns <0 if this value < argument
	//          0 if this value = argument
	//         >0 if this value > argument
	Cmp(T) int
}

Cmp is a companion interface for Ordered Embeds comparable so that the Cmp interface can be a map key

type Complex

type Complex interface {
	~complex64 | ~complex128
}

Complex is copied from golang.org/x/exp/constraints#Complex

type Float

type Float interface {
	~float32 | ~float64
}

Float is copied from golang.org/x/exp/constraints#Float

type Integer

type Integer interface {
	SignedInteger | UnsignedInteger
}

Integer is equivalent to golang.org/x/exp/constraints#Integer

type IntegerAndFloat

type IntegerAndFloat interface {
	Integer | Float
}

IntegerAndFloat describes any signed or unsigned integer type and any float type

type Numeric

type Numeric interface {
	IntegerAndFloat | *big.Int | *big.Float | *big.Rat
}

Numeric describes any numeric type except complex

type Ordered

type Ordered interface {
	Signed | UnsignedInteger | ~string
}

Ordered is equivalent to golang.org/x/exp/constraints#Ordered

type Signed

type Signed interface {
	SignedInteger | Float
}

Signed differs from golang.org/x/exp/constraints#Signed - it includes Float

type SignedInteger

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

SignedInteger is copied from golang.org/x/exp/constraints#Signed

type UnsignedInteger

type UnsignedInteger interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}

UnsignedInteger is like golang.org/x/exp/constraints#Unsigned, except no uintptr

Jump to

Keyboard shortcuts

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