todo

package
v0.0.0-...-98fa19b Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Call

func Call(f func())

Call the provided function, safely wrapped in a errs.Recovery() handler that logs any errors via slog.

func CallWithHandler

func CallWithHandler(f func(), errHandler func(err error))

CallWithHandler calls the provided function, safely wrapped in a errs.Recovery() handler.

func IfErr

func IfErr(err error)

IfErr checks the error and if it isn't nil, calls fatal.WithErr(err).

func WithErr

func WithErr(err error)

WithErr logs the error and then exits with code 1.

Types

type BitSet

type BitSet struct {
	// contains filtered or unexported fields
}

BitSet contains a set of bits.

func (*BitSet) Clear

func (b *BitSet) Clear(index int)

Clear the bit at 'index'.

func (*BitSet) ClearRange

func (b *BitSet) ClearRange(start, end int)

ClearRange clears the bits from 'start' to 'end', inclusive.

func (*BitSet) Clone

func (b *BitSet) Clone() *BitSet

Clone this BitSet.

func (*BitSet) Copy

func (b *BitSet) Copy(other *BitSet)

Copy the content of 'other' into this BitSet, making them equal.

func (*BitSet) Count

func (b *BitSet) Count() int

Count returns the number of set bits.

func (*BitSet) Data

func (b *BitSet) Data() []uint64

Data returns a copy of the underlying storage.

func (*BitSet) EnsureCapacity

func (b *BitSet) EnsureCapacity(words int)

EnsureCapacity ensures that the BitSet has enough underlying storage to accommodate setting a bit as high as index position 'words' x 64 - 1 without needing to allocate more storage.

func (*BitSet) Equal

func (b *BitSet) Equal(other *BitSet) bool

Equal returns true if this BitSet is equal to 'other'.

func (*BitSet) FirstSet

func (b *BitSet) FirstSet() int

FirstSet returns the first set bit. If no bits are set, then -1 is returned.

func (*BitSet) Flip

func (b *BitSet) Flip(index int)

Flip the bit at 'index'.

func (*BitSet) FlipRange

func (b *BitSet) FlipRange(start, end int)

FlipRange flips the bits from 'start' to 'end', inclusive.

func (*BitSet) LastSet

func (b *BitSet) LastSet() int

LastSet returns the last set bit. If no bits are set, then -1 is returned.

func (*BitSet) Load

func (b *BitSet) Load(data []uint64)

Load replaces the current data with the bits set in 'data'.

func (*BitSet) NextClear

func (b *BitSet) NextClear(start int) int

NextClear returns the next clear bit starting from 'start'.

func (*BitSet) NextSet

func (b *BitSet) NextSet(start int) int

NextSet returns the next set bit starting from 'start'. If no bits are set at or beyond 'start', then -1 is returned.

func (*BitSet) PreviousClear

func (b *BitSet) PreviousClear(start int) int

PreviousClear returns the previous clear bit starting from 'start'. If no bits are clear at or before 'start', then -1 is returned.

func (*BitSet) PreviousSet

func (b *BitSet) PreviousSet(start int) int

PreviousSet returns the previous set bit starting from 'start'. If no bits are set at or before 'start', then -1 is returned.

func (*BitSet) Reset

func (b *BitSet) Reset()

Reset the BitSet back to an empty state.

func (*BitSet) Set

func (b *BitSet) Set(index int)

Set the bit at 'index'.

func (*BitSet) SetRange

func (b *BitSet) SetRange(start, end int)

SetRange sets the bits from 'start' to 'end', inclusive.

func (*BitSet) State

func (b *BitSet) State(index int) bool

State returns the state of the bit at 'index'.

func (*BitSet) Trim

func (b *BitSet) Trim()

Trim the BitSet down to the minimum required to store the set bits.

Directories

Path Synopsis
Package desktop provides desktop integration utilities.
Package desktop provides desktop integration utilities.
Package errs implements a detailed error object that provides stack traces with source locations, along with nested causes, if any.
Package errs implements a detailed error object that provides stack traces with source locations, along with nested causes, if any.
Package taskqueue provides a simple asynchronous task queue.
Package taskqueue provides a simple asynchronous task queue.
Package txt provides various text utilities.
Package txt provides various text utilities.

Jump to

Keyboard shortcuts

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