Documentation
¶
Index ¶
- type Computation
- func (me Computation) AndThen(then Computation) Computation
- func (me Computation) Bool(l, r bool) Computation
- func (me Computation) Cmp(i int) Computationdeprecated
- func (me Computation) CmpInt64(i int64) Computation
- func (me Computation) Compare[T constraints.Ordered](l, r T) Computation
- func (me Computation) EagerSameLess(same, less bool) Computation
- func (me Computation) Float64(l, r float64) Computationdeprecated
- func (me Computation) Int(l, r int) Computationdeprecated
- func (me Computation) Int64(l, r int64) Computationdeprecated
- func (me Computation) Lazy(f func() Computation) Computation
- func (me Computation) LazySameLess(lazy func() (same, less bool)) Computation
- func (me Computation) Less() bool
- func (me Computation) LessOk() (less, ok bool)
- func (me Computation) MustLess() bool
- func (me Computation) Ok() bool
- func (me Computation) OrderingInt() int
- func (me Computation) Then(i int) Computation
- func (me Computation) Uint32(l, r uint32) Computationdeprecated
- func (me Computation) Uint64(l, r uint64) Computationdeprecated
- func (me Computation) Uintptr(l, r uintptr) Computationdeprecated
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Computation ¶
type Computation struct {
// contains filtered or unexported fields
}
A helper for long chains of "less-than" comparisons, where later comparisons are only required if earlier ones haven't resolved the comparison.
func EagerOrdered
deprecated
func EagerOrdered[T constraints.Ordered](start Computation, l, r T) Computation
Applies builtin ordering if necessary.
Deprecated: Use Computation.Compare (requires Go 1.27).
func New ¶
func New() Computation
func (Computation) AndThen ¶
func (me Computation) AndThen(then Computation) Computation
func (Computation) Bool ¶
func (me Computation) Bool(l, r bool) Computation
Sorts so that false comes before true.
func (Computation) Cmp
deprecated
func (me Computation) Cmp(i int) Computation
Deprecated: Use Computation.Then.
func (Computation) CmpInt64 ¶
func (me Computation) CmpInt64(i int64) Computation
func (Computation) Compare ¶ added in v0.5.0
func (me Computation) Compare[T constraints.Ordered](l, r T) Computation
Compare applies the builtin ordering of l and r if the computation isn't decided yet. Unlike Computation.Then, which takes the result of a three-way comparison, it takes the two values. Unlike cmp.Compare, a NaN operand doesn't sort first: it decides the computation as not less.
func (Computation) EagerSameLess ¶
func (me Computation) EagerSameLess(same, less bool) Computation
func (Computation) Float64
deprecated
func (me Computation) Float64(l, r float64) Computation
Deprecated: Use Computation.Compare (requires Go 1.27).
func (Computation) Int
deprecated
func (me Computation) Int(l, r int) Computation
Deprecated: Use Computation.Compare (requires Go 1.27).
func (Computation) Int64
deprecated
func (me Computation) Int64(l, r int64) Computation
Deprecated: Use Computation.Compare (requires Go 1.27).
func (Computation) Lazy ¶
func (me Computation) Lazy(f func() Computation) Computation
func (Computation) LazySameLess ¶
func (me Computation) LazySameLess(lazy func() (same, less bool)) Computation
func (Computation) Less ¶
func (me Computation) Less() bool
func (Computation) LessOk ¶
func (me Computation) LessOk() (less, ok bool)
func (Computation) MustLess ¶
func (me Computation) MustLess() bool
func (Computation) Ok ¶
func (me Computation) Ok() bool
func (Computation) OrderingInt ¶
func (me Computation) OrderingInt() int
Returns -1 if less, 0 if equal, and 1 if greater than
func (Computation) Then ¶ added in v0.5.0
func (me Computation) Then(i int) Computation
Then applies the sign of a three-way comparison result, such as from cmp.Compare, bytes.Compare or time.Time.Compare, if the computation isn't decided yet: negative is less, positive is greater, and zero leaves it undecided. It's named after Rust's Ordering::then.
func (Computation) Uint32
deprecated
func (me Computation) Uint32(l, r uint32) Computation
Deprecated: Use Computation.Compare (requires Go 1.27).
func (Computation) Uint64
deprecated
func (me Computation) Uint64(l, r uint64) Computation
Deprecated: Use Computation.Compare (requires Go 1.27).
func (Computation) Uintptr
deprecated
func (me Computation) Uintptr(l, r uintptr) Computation
Deprecated: Use Computation.Compare (requires Go 1.27).