Documentation ¶
Index ¶
- Constants
- func Abs[T Rational](v T) T
- func Add[T Rational](l, r T) T
- func As[F, T any](f F) T
- func AsAny[T any](t T) any
- func AsKey[K, V any](o any) K
- func AsResultFn[T any](fn func() (T, error)) func() Result[T]
- func BoolNum[T Rational](b bool) T
- func CanAssign[F, T any]() bool
- func CastRat[F, T Rational](f F) T
- func Choose[T any](b bool, t T, f T) T
- func Clamp[T constraints.Ordered](v, lo, hi T) T
- func CloneSlice[T any](s []T) []T
- func CmpAs[F, T any](impl CmpImpl[T]) func(l, r F) CmpResult
- func Coalesce[T comparable](vs ...T) T
- func CoalesceR[T comparable](vs ...T) T
- func Const[T any](v T) func() T
- func DefaultHash() hash.Hash64
- func Div[T Rational](l, r T) T
- func Eq[T comparable](l, r T) bool
- func Ge[T constraints.Ordered](l, r T) bool
- func Gt[T constraints.Ordered](l, r T) bool
- func HashBytes(s []byte) uintptr
- func HashStr(s string) uintptr
- func Identity[T any]() func(T) T
- func Is[I any](v any) bool
- func KvMaker[K, V any](fn func(v V) K) func(v V) Kv[K, V]
- func Le[T constraints.Ordered](l, r T) bool
- func Lt[T constraints.Ordered](l, r T) bool
- func Max[T constraints.Ordered](vs ...T) T
- func Min[T constraints.Ordered](vs ...T) T
- func Mod[T constraints.Integer](l, r T) T
- func Mul[T Rational](l, r T) T
- func Ne[T comparable](l, r T) bool
- func Pow2Ceil[T constraints.Integer](num T) T
- func Prod[T Rational](vs ...T) T
- func PtrTo[T any](v T) *T
- func SetIfAbsent[T any](o *Optional[T], fn func() T) T
- func Sub[T Rational](l, r T) T
- func Sum[T Rational](vs ...T) T
- func Zero[T any]() T
- type AnyBox
- type AnyIterable
- type AnyKv
- type AnyMap
- type AnyMapImpl
- type AnyOptional
- type AnySlice
- type AnySliceImpl
- type AnySliceIterator
- type BiFunc
- type Box
- type BoxImpl
- type Bytes
- type CmpImpl
- type CmpResult
- type Comparer
- type EqImpl
- type Equaler
- type ErrFn
- type HashEq
- type HashEqImpl
- func BoolHashEq() HashEqImpl[bool]
- func DefaultHashEqImpl[T any]() HashEqImpl[T]
- func HashEqAs[F, T any](impl HashEqImpl[T]) HashEqImpl[F]
- func HashEqOf[T any](hash HashImpl[T], eq EqImpl[T]) HashEqImpl[T]
- func IntHashEq[T constraints.Integer]() HashEqImpl[T]
- func MethodHashEqImpl[T HashEq[T]]() HashEqImpl[T]
- func OptionalHashEq[T any](he HashEqImpl[T]) HashEqImpl[Optional[T]]
- func StrHashEq() HashEqImpl[string]
- type HashImpl
- type Hasher
- type Iterable
- type Iterator
- type IteratorExhaustedError
- type Kv
- type LessImpl
- type Lesser
- type MutAnyBox
- type MutAnyMap
- type MutAnyMapImpl
- func (m MutAnyMapImpl[K, V]) Contains(k any) bool
- func (m MutAnyMapImpl[K, V]) Default(k, v any) bool
- func (m MutAnyMapImpl[K, V]) Delete(k any)
- func (m MutAnyMapImpl[K, V]) ForEach(fn func(kv Kv[any, any]) bool) bool
- func (m MutAnyMapImpl[K, V]) Get(k any) any
- func (m MutAnyMapImpl[K, V]) Len() int
- func (m MutAnyMapImpl[K, V]) Put(k, v any)
- func (m MutAnyMapImpl[K, V]) TryGet(k any) (any, bool)
- type MutAnySlice
- type MutAnySliceImpl
- type MutBox
- type MutBoxImpl
- type NoCopy
- type NoValueError
- type Numeric
- type Optional
- func (o Optional[T]) FlatMap(f func(T) Optional[T]) Optional[T]
- func (o Optional[T]) ForEach(fn func(v T) bool) bool
- func (o Optional[T]) IfAbsent(fn func())
- func (o Optional[T]) IfPresent(fn func(v T))
- func (o Optional[T]) Interface() any
- func (o Optional[T]) Iterate() Iterator[T]
- func (o Optional[T]) Map(f func(T) T) Optional[T]
- func (o Optional[T]) MarshalJSON() ([]byte, error)
- func (o Optional[T]) Or(d T) T
- func (o Optional[T]) OrFn(f func() T) T
- func (o Optional[T]) OrZero() T
- func (o Optional[T]) Present() bool
- func (o Optional[T]) Replace(v any) AnyOptional
- func (o Optional[T]) Type() reflect.Type
- func (o *Optional[T]) UnmarshalJSON(b []byte) error
- func (o Optional[T]) Value() T
- func (o Optional[T]) ZeroInterface() any
- type Pair
- type Range
- func (r Range[T]) AnyIterate() Iterator[any]
- func (r Range[T]) AsAnySlice() AnySlice
- func (r Range[T]) AsSlice() []T
- func (r Range[T]) CheckNormal(n T) Range[T]
- func (r Range[T]) ForEach(fn func(T) bool) bool
- func (r Range[T]) HasNext() bool
- func (r Range[T]) Iterate() Iterator[T]
- func (r Range[T]) Len() T
- func (r Range[T]) Next() (Range[T], bool)
- func (r Range[T]) Slice() []T
- func (r Range[T]) StepOrOne() T
- type RangeError
- type Rational
- type Result
- type Stringer
- type Traversable
Constants ¶
View Source
const ( CmpLesser = -1 CmpEqual = 0 CmpGreater = 1 )
Variables ¶
This section is empty.
Functions ¶
func AsResultFn ¶
func Clamp ¶
func Clamp[T constraints.Ordered](v, lo, hi T) T
func CloneSlice ¶
func CloneSlice[T any](s []T) []T
func Coalesce ¶
func Coalesce[T comparable](vs ...T) T
func CoalesceR ¶
func CoalesceR[T comparable](vs ...T) T
func DefaultHash ¶
func Eq ¶
func Eq[T comparable](l, r T) bool
func Ge ¶
func Ge[T constraints.Ordered](l, r T) bool
func Gt ¶
func Gt[T constraints.Ordered](l, r T) bool
func Le ¶
func Le[T constraints.Ordered](l, r T) bool
func Lt ¶
func Lt[T constraints.Ordered](l, r T) bool
func Max ¶
func Max[T constraints.Ordered](vs ...T) T
func Min ¶
func Min[T constraints.Ordered](vs ...T) T
func Mod ¶
func Mod[T constraints.Integer](l, r T) T
func Ne ¶
func Ne[T comparable](l, r T) bool
func Pow2Ceil ¶
func Pow2Ceil[T constraints.Integer](num T) T
func SetIfAbsent ¶
Types ¶
type AnyIterable ¶
type AnyMapImpl ¶
type AnyMapImpl[K comparable, V any] struct { // contains filtered or unexported fields }
func AnyMapOf ¶
func AnyMapOf[K comparable, V any](m map[K]V) AnyMapImpl[K, V]
func (AnyMapImpl[K, V]) Contains ¶
func (m AnyMapImpl[K, V]) Contains(k any) bool
func (AnyMapImpl[K, V]) Get ¶
func (m AnyMapImpl[K, V]) Get(k any) any
func (AnyMapImpl[K, V]) Len ¶
func (m AnyMapImpl[K, V]) Len() int
type AnyOptional ¶
type AnySliceImpl ¶
type AnySliceImpl[T any] struct { // contains filtered or unexported fields }
func AnySliceOf ¶
func AnySliceOf[T any](s []T) AnySliceImpl[T]
func (AnySliceImpl[T]) Get ¶
func (s AnySliceImpl[T]) Get(i int) any
func (AnySliceImpl[T]) Iterate ¶
func (s AnySliceImpl[T]) Iterate() Iterator[any]
func (AnySliceImpl[T]) Len ¶
func (s AnySliceImpl[T]) Len() int
type AnySliceIterator ¶
type AnySliceIterator struct {
// contains filtered or unexported fields
}
func IterateAnySlice ¶
func IterateAnySlice(s AnySlice) *AnySliceIterator
func (*AnySliceIterator) HasNext ¶
func (i *AnySliceIterator) HasNext() bool
func (*AnySliceIterator) Iterate ¶
func (i *AnySliceIterator) Iterate() Iterator[any]
func (*AnySliceIterator) Next ¶
func (i *AnySliceIterator) Next() any
type CmpResult ¶
type CmpResult int8
func OrderedCmp ¶
func OrderedCmp[T constraints.Ordered](l, r T) CmpResult
type HashEqImpl ¶
func BoolHashEq ¶
func BoolHashEq() HashEqImpl[bool]
func DefaultHashEqImpl ¶
func DefaultHashEqImpl[T any]() HashEqImpl[T]
func HashEqAs ¶
func HashEqAs[F, T any](impl HashEqImpl[T]) HashEqImpl[F]
func IntHashEq ¶
func IntHashEq[T constraints.Integer]() HashEqImpl[T]
func MethodHashEqImpl ¶
func MethodHashEqImpl[T HashEq[T]]() HashEqImpl[T]
func OptionalHashEq ¶
func OptionalHashEq[T any](he HashEqImpl[T]) HashEqImpl[Optional[T]]
func StrHashEq ¶
func StrHashEq() HashEqImpl[string]
type IteratorExhaustedError ¶
type IteratorExhaustedError struct{}
type LessImpl ¶
func CmpLessImpl ¶
type MutAnyMapImpl ¶
type MutAnyMapImpl[K comparable, V any] struct { // contains filtered or unexported fields }
func MutAnyMapOf ¶
func MutAnyMapOf[K comparable, V any](m map[K]V) MutAnyMapImpl[K, V]
func (MutAnyMapImpl[K, V]) Contains ¶
func (m MutAnyMapImpl[K, V]) Contains(k any) bool
func (MutAnyMapImpl[K, V]) Default ¶
func (m MutAnyMapImpl[K, V]) Default(k, v any) bool
func (MutAnyMapImpl[K, V]) Delete ¶
func (m MutAnyMapImpl[K, V]) Delete(k any)
func (MutAnyMapImpl[K, V]) Get ¶
func (m MutAnyMapImpl[K, V]) Get(k any) any
func (MutAnyMapImpl[K, V]) Len ¶
func (m MutAnyMapImpl[K, V]) Len() int
func (MutAnyMapImpl[K, V]) Put ¶
func (m MutAnyMapImpl[K, V]) Put(k, v any)
type MutAnySlice ¶
type MutAnySliceImpl ¶
type MutAnySliceImpl[T any] struct { // contains filtered or unexported fields }
func MutAnySliceOf ¶
func MutAnySliceOf[T any](s []T) MutAnySliceImpl[T]
func (MutAnySliceImpl[T]) Get ¶
func (s MutAnySliceImpl[T]) Get(i int) any
func (MutAnySliceImpl[T]) Iterate ¶
func (s MutAnySliceImpl[T]) Iterate() Iterator[any]
func (MutAnySliceImpl[T]) Len ¶
func (s MutAnySliceImpl[T]) Len() int
func (MutAnySliceImpl[T]) Set ¶
func (s MutAnySliceImpl[T]) Set(i int, e any)
type MutBoxImpl ¶
type MutBoxImpl[T any] struct { // contains filtered or unexported fields }
func (*MutBoxImpl[T]) Get ¶
func (b *MutBoxImpl[T]) Get() T
func (*MutBoxImpl[T]) Set ¶
func (b *MutBoxImpl[T]) Set(v T)
type NoCopy ¶
type NoCopy struct{}
type NoValueError ¶
type NoValueError struct{}
func (NoValueError) Error ¶
func (e NoValueError) Error() string
type Numeric ¶
type Numeric interface { Rational | constraints.Complex }
type Optional ¶
type Optional[T any] struct { // contains filtered or unexported fields }
func (Optional[T]) MarshalJSON ¶
func (Optional[T]) Replace ¶
func (o Optional[T]) Replace(v any) AnyOptional
func (*Optional[T]) UnmarshalJSON ¶
func (Optional[T]) ZeroInterface ¶
type Range ¶
type Range[T Rational] struct { Start, Stop, Step T }
func (Range[T]) AnyIterate ¶
func (Range[T]) AsAnySlice ¶
func (Range[T]) CheckNormal ¶
type RangeError ¶
func (RangeError[T]) Error ¶
func (e RangeError[T]) Error() string
func (RangeError[T]) Unwrap ¶
func (e RangeError[T]) Unwrap() error
type Rational ¶
type Rational interface { constraints.Integer | constraints.Float }
type Traversable ¶
Click to show internal directories.
Click to hide internal directories.