bounded

package
v1.0.124 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clamp

func Clamp[T any](b Bounded[T]) func(T) T

Clamp returns a function that clamps against the bounds defined in the bounded type

Types

type Bounded

type Bounded[T any] interface {
	O.Ord[T]
	Top() T
	Bottom() T
}

func MakeBounded

func MakeBounded[T any](o O.Ord[T], t, b T) Bounded[T]

MakeBounded creates an instance of a bounded type

func Reverse

func Reverse[T any](b Bounded[T]) Bounded[T]

Reverse reverses the ordering and swaps the bounds

Jump to

Keyboard shortcuts

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