util

package
v0.0.0-...-af49336 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Fatal = log.Fatalf
View Source
var Format = fmt.Sprintf
View Source
var Log = log.Printf
View Source
var Panic = log.Panicf

Functions

func Assert

func Assert(b bool, args ...any)

func AssertEQ

func AssertEQ[N Number](a, b N, args ...any)

func AssertGE

func AssertGE[N Number](a, b N, args ...any)

func AssertGT

func AssertGT[N Number](a, b N, args ...any)

func AssertLE

func AssertLE[N Number](a, b N, args ...any)

func AssertLT

func AssertLT[N Number](a, b N, args ...any)

func BytesFormat

func BytesFormat(format string, args ...any) []byte

func CatSlices

func CatSlices[T any](args ...[]T) (result []T)

func Check

func Check(err error, args ...any)

func Cond

func Cond[T any](a bool, b T, c T) T

func Errorf

func Errorf(f string, args ...any) error

func Hi

func Hi(x uint) byte

func HiLo

func HiLo(a, b byte) uint

func HiLoBy

func HiLoBy(bb []byte) uint

func InSlice

func InSlice[T comparable_](x T, slice []T) bool

InSlice tells whether x is in slice.

func LenSlice

func LenSlice[T any](x []T) uint

LenSlice is for slices; it returns uint.

func LenStr

func LenStr(s string) uint

LenStr is for strings; it returns uint.

func Lo

func Lo(x uint) byte

func Max

func Max[T Number](b T, c T) T

func Min

func Min[T Number](b T, c T) T

func NonBlockingReadChan

func NonBlockingReadChan[T any](c <-chan *T) (*T, bool)

func NonBlockingWriteChan

func NonBlockingWriteChan[T any](c chan<- *T, p *T) (ok bool)

func Repr

func Repr[T any](a T) string

func Str

func Str[T any](a T) string

func Value

func Value[T any](value T, err error) T

Types

type Number

type Number interface {
	~int8 | ~int16 | ~int32 | ~uint8 | ~uint16 | ~uint32 | ~int | ~uint | ~int64 | ~uint64 | ~uintptr
}

Jump to

Keyboard shortcuts

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