Versions in this module Expand all Collapse all v0 v0.2.1 Feb 9, 2024 Changes in this version + const SMALL_LINE_SEP + const UPPER_HEX_DIGITS + var ANSI_ESCAPE_SEQUENCE_REGEX = regexp.MustCompile(...) + var ErrInvalidPercentEncodedString = errors.New("invalid percent encoded string") + var ErrOutOfSpace = errors.New("out of space") + var MATCHALL_REGEX = regexp.MustCompile(".*") + func Abs[T constraints.Integer](a T) T + func AddCarriageReturnAfterNewlines(s string) string + func AssertNoGoroutineLeak(t *testing.T, startCount int) + func AssertNoMemoryLeak(t *testing.T, startStats *runtime.MemStats, maxAllocDelta uint64, ...) + func BytesAsString(b []byte) string + func Catch(fn func()) (result error) + func CombineErrors(errs ...error) error + func CombineErrorsWithPrefixMessage(prefixMsg string, errs ...error) error + func ConvertPanicValueToError(v any) error + func ConvertStringSlice[A ~string, B ~string](s []A) []B + func CountDigits(n int64) int + func CountPrevBackslashes[T constraints.Integer](s []T, i int32) int32 + func DefaultIfZero[T constraints.Integer](v, defaultValue T) T + func EmptySliceIfNil[T any](slice []T) []T + func EqualMaps[K comparable, V any](m1 map[K]V, m2 map[K]V, eql func(v1, v2 V) bool) bool + func FilterMapSlice[T any, U any](s []T, mapper func(e T) (U, bool)) []U + func FilterSliceByType[T any, V any](s []T, filter V) []V + func FilterSlice[T any](s []T, filter func(e T) bool) []T + func FindClosestString(ctx context.Context, candidates []string, v string, maxDifferences int) (string, int, bool) + func FindClosest[T any](search ClosestSearch[T]) (sourceIndex int, minDistance int) + func FindDoubleLineSequence(bytes []byte) (index int, length int) + func FindLongestCommonPrefix(strs []string) string + func GetByteSize[T any]() uintptr + func HexDigitToByte(c byte) byte + func If[T any](cond bool, a, b T) T + func Implements[T any](v any) bool + func IndentLines(s string, indent string) string + func InefficientlyWaitUntilFalse(b *atomic.Bool, timeout time.Duration) bool + func InefficientlyWaitUntilTrue(b *atomic.Bool, timeout time.Duration) bool + func IsContextDone(ctx context.Context) bool + func IsHexDigit(c byte) bool + func IsWholeInt64[F ~float64](f F) bool + func MapSliceIndexed[T any, U any](s []T, mapper func(e T, i int) U) []U + func MapSlice[T any, U any](s []T, mapper func(e T) U) []U + func MarshalIndentJsonNoHTMLEspace(v any, prefix, indent string) ([]byte, error) + func MarshalJsonNoHTMLEspace(v any) ([]byte, error) + func Max[T constraints.Ordered](a, b T) T + func MinMaxPossibleRuneCount(byteCount int) (int, int) + func Min[T constraints.Ordered](a T, b T) T + func MoveCursorNextLine(writer io.Writer, n int) + func Must2[T any, U any](a T, b U, err error) (T, U) + func MustGet[T any](a T, found bool) T + func MustWriteMany[W io.Writer](w W, slices ...[]byte) + func Must[T any](a T, err error) T + func New[T any](v T) *T + func PanicIfErr(err error) + func PanicIfErrAmong(errs ...error) + func PercentDecode(s string, allowNotEncoded bool) (string, error) + func PercentEncode(s string) string + func PrintSmallLineSeparator(w io.Writer) + func RandFloat(low, high float64, seed uint64) float64 + func Recover() any + func RemoveIndexOfSlice[T any](s []T, index int) []T + func RepeatValue[T any](n int, v T) []T + func Repeat[T any](n int, fn func(index int) T) []T + func Ret0[A, B any](a A, b B) A + func Ret1[A, B any](a A, b B) B + func Ret[V any](v V) func() V + func ReversedSlice[T any](s []T) []T + func SameKeys[K comparable, V any](m1 map[K]V, m2 map[K]V) bool + func SamePointer(a, b interface{}) bool + func ShrinkSliceIfWastedCapacity[E any](slice []E, minShrinkableStackLength int, stackShrinkDivider int) []E + func SliceContains[T constraints.Ordered](slice []T, v T) bool + func Some[T any](s []T, predicate func(e T) bool) bool + func StringAsBytes[T ~string](s T) []byte + func StripANSISequences(str string) string + func WriteMany[W io.Writer](w W, slices ...[]byte) error + type AssertNoMemoryLeakOptions struct + CheckGoroutines bool + GoroutineCount int + MaxGoroutineCountDelta uint8 + PreSleepDurationMillis uint8 + type ClosestSearch struct + ComputeLevenshteinMatrix func(source T, target T) [][]int + Context context.Context + GetSourceI func(i int) (source T, ok bool) + IsRelevant func(candidate T, distance int) bool + MaxDifferences int + OptionalFilter func(source T, target T) bool + Target T + type FixedBufferWriter []byte + func (w *FixedBufferWriter) Write(p []byte) (int, error) + type FnReader func(p []byte) (n int, err error) + func (fn FnReader) Read(p []byte) (n int, err error) + type FnReaderWriter struct + ReadFn func(p []byte) (n int, err error) + WriteFn func(p []byte) (n int, err error) + func (w FnReaderWriter) Read(p []byte) (n int, err error) + func (w FnReaderWriter) Write(p []byte) (n int, err error) + type FnReaderWriterCloser struct + CloseFn func() error + ReadFn func(p []byte) (n int, err error) + WriteFn func(p []byte) (n int, err error) + func (w FnReaderWriterCloser) Close() error + func (w FnReaderWriterCloser) Read(p []byte) (n int, err error) + func (w FnReaderWriterCloser) Write(p []byte) (n int, err error) + type FnWriter struct + WriteFn func(p []byte) (n int, err error) + func (writer FnWriter) Write(p []byte) (n int, err error) + type TestWriter struct + T *testing.T + func (w *TestWriter) Write(p []byte) (n int, err error)