internal

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CapacityOf added in v0.9.0

func CapacityOf(v any) (any, bool)

CapacityOf returns the comparable capacity of v.

For numeric values, it returns the numeric value itself.

For measurable values (arrays, slices, maps, strings, and channels), it returns their capacity.

The second return value reports whether v has a comparable magnitude.

func CompareCapacity added in v0.9.0

func CompareCapacity(a, b any) (int, bool)

CompareCapacity compares the capacity of two numeric or measurable values.

Numeric values may be of different built-in numeric types. Measurable values (arrays, slices, maps, strings, and channels) are compared using their capacity.

It returns:

-1 if a < b
 0 if a == b
 1 if a > b

The second return value reports whether both operands could be compared. It is false if either value is neither numeric nor measurable, or if the comparison cannot be performed safely without losing numeric precision.

func CompareMagnitude added in v0.6.0

func CompareMagnitude(a, b any) (int, bool)

CompareMagnitude compares two numeric or measurable values.

Numeric values may be of different built-in numeric types. Measurable values (arrays, slices, maps, strings, and channels) are compared using their length.

It returns:

-1 if a < b
 0 if a == b
 1 if a > b

The second return value reports whether both operands could be compared. It is false if either value is neither numeric nor measurable, or if the comparison cannot be performed safely without losing numeric precision.

func FormatMessage

func FormatMessage(message ...any) string

FormatMessage processes the input arguments to return a formatted string. If the first argument is a string, it is treated as a format specifier. Otherwise, it returns a string representation of all arguments.

func MagnitudeOf added in v0.6.0

func MagnitudeOf(v any) (any, bool)

MagnitudeOf returns the comparable magnitude of v.

For numeric values, it returns the numeric value itself.

For measurable values (arrays, slices, maps, strings, and channels), it returns their length.

The second return value reports whether v has a comparable magnitude.

Types

type Float added in v0.6.0

type Float interface {
	~float32 | ~float64
}

Float represents any built-in floating-point type.

type Number added in v0.3.0

type Number interface {
	Signed | Unsigned | Float
}

Number represents any built-in numeric type supported by this package.

It includes all signed and unsigned integer types, uintptr, and floating-point types.

type Signed added in v0.6.0

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

Signed represents any built-in signed integer type.

type Unsigned added in v0.6.0

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

Unsigned represents any built-in unsigned integer type, including uintptr.

Jump to

Keyboard shortcuts

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