generic

package
v0.0.0-...-f8d4386 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: CC0-1.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare[T any](a, b T, less LessFn[T]) int

Compare uses a less function to determine the ordering of 'a' and 'b'. It returns:

* -1 if a < b

* 1 if a > b

* 0 if a == b

func Equals

func Equals[T comparable](a, b T) bool

Equals wraps the '==' operator for comparable types.

func Less

func Less[T constraints.Ordered](a, b T) bool

Less wraps the '<' operator for ordered types.

Types

type EqualsFn

type EqualsFn[T any] func(a, b T) bool

EqualsFn is a function that returns whether 'a' and 'b' are equal.

type HashFn

type HashFn[T any] func(t T) uint64

HashFn is a function that returns the hash of 't'.

type LessFn

type LessFn[T any] func(a, b T) bool

LessFn is a function that returns whether 'a' is less than 'b'.

Jump to

Keyboard shortcuts

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