Documentation
¶
Overview ¶
Package gopt contains various optimizations for go
Index ¶
- func BytesToString(b []byte) (s string)
- func StringToBytes(s string) (b []byte)
- type Bitset
- type NumberConstraint
- type RingBuffer
- func (rb *RingBuffer[T]) At(i int) T
- func (rb *RingBuffer[T]) BackingSlice() []T
- func (rb *RingBuffer[T]) Cap() int
- func (rb *RingBuffer[T]) Head() T
- func (rb *RingBuffer[T]) Insert(vals ...T)
- func (rb *RingBuffer[T]) Len() int
- func (rb *RingBuffer[T]) Max() T
- func (rb *RingBuffer[T]) Min() T
- func (rb *RingBuffer[T]) Tail() T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToString ¶
func StringToBytes ¶ added in v1.0.1
Credit to https://github.com/valyala/fasthttp?tab=readme-ov-file#tricks-with-byte-buffers
Types ¶
type Bitset ¶ added in v1.2.3
type Bitset struct {
// contains filtered or unexported fields
}
type NumberConstraint ¶ added in v1.1.1
type RingBuffer ¶ added in v1.1.1
type RingBuffer[T NumberConstraint] struct { // contains filtered or unexported fields }
func NewRingBuffer ¶ added in v1.1.1
func NewRingBuffer[T NumberConstraint](cap int, initialValues ...T) *RingBuffer[T]
NewRingBuffer created a new ring buffer. note that the ring buffer is not thread safe
func (*RingBuffer[T]) At ¶ added in v1.1.1
func (rb *RingBuffer[T]) At(i int) T
At function to make indexing the ring buffer simpler. this is eq to slice[i]
func (*RingBuffer[T]) BackingSlice ¶ added in v1.1.1
func (rb *RingBuffer[T]) BackingSlice() []T
func (*RingBuffer[T]) Cap ¶ added in v1.1.1
func (rb *RingBuffer[T]) Cap() int
func (*RingBuffer[T]) Head ¶ added in v1.1.1
func (rb *RingBuffer[T]) Head() T
Head returns the oldest inserted value in the ring buffer
func (*RingBuffer[T]) Insert ¶ added in v1.1.1
func (rb *RingBuffer[T]) Insert(vals ...T)
Insert values into the ring buffer
func (*RingBuffer[T]) Len ¶ added in v1.1.1
func (rb *RingBuffer[T]) Len() int
func (*RingBuffer[T]) Max ¶ added in v1.2.3
func (rb *RingBuffer[T]) Max() T
func (*RingBuffer[T]) Min ¶ added in v1.2.3
func (rb *RingBuffer[T]) Min() T
func (*RingBuffer[T]) Tail ¶ added in v1.2.0
func (rb *RingBuffer[T]) Tail() T
Tail returns the latest inserted value in the ring buffer
Click to show internal directories.
Click to hide internal directories.