Documentation
¶
Overview ¶
Package gopt contains various optimizations for go
Index ¶
- func BytesToString(b []byte) (s string)
- func StringToBytes(s string) (b []byte)
- type AtomicQueue
- 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
- type Semaphore
- type ShardedMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToString ¶
Types ¶
type AtomicQueue ¶
type AtomicQueue[T any] struct { // contains filtered or unexported fields }
func NewAtomicQueue ¶
func NewAtomicQueue[T any]() *AtomicQueue[T]
func (*AtomicQueue[T]) Len ¶
func (q *AtomicQueue[T]) Len() int
func (*AtomicQueue[T]) Pop ¶
func (q *AtomicQueue[T]) Pop() (val T, ok bool)
func (*AtomicQueue[T]) Push ¶
func (q *AtomicQueue[T]) Push(val T)
type Bitset ¶
type Bitset struct {
// contains filtered or unexported fields
}
type NumberConstraint ¶
type RingBuffer ¶
type RingBuffer[T any] struct { // contains filtered or unexported fields }
func NewRingBuffer ¶
func NewRingBuffer[T any](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 ¶
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 ¶
func (rb *RingBuffer[T]) BackingSlice() []T
func (*RingBuffer[T]) Cap ¶
func (rb *RingBuffer[T]) Cap() int
func (*RingBuffer[T]) Head ¶
func (rb *RingBuffer[T]) Head() T
Head returns the oldest inserted value in the ring buffer
func (*RingBuffer[T]) Insert ¶
func (rb *RingBuffer[T]) Insert(vals ...T)
Insert values into the ring buffer
func (*RingBuffer[T]) Len ¶
func (rb *RingBuffer[T]) Len() int
func (*RingBuffer[T]) Max ¶
func (rb *RingBuffer[T]) Max() T
func (*RingBuffer[T]) Min ¶
func (rb *RingBuffer[T]) Min() T
func (*RingBuffer[T]) Tail ¶
func (rb *RingBuffer[T]) Tail() T
Tail returns the latest inserted value in the ring buffer
type Semaphore ¶
type Semaphore struct {
// contains filtered or unexported fields
}
func NewSemaphore ¶
type ShardedMap ¶
func NewShardedMap ¶
func NewShardedMap[K string, V any](shards int) (sm *ShardedMap[K, V])
func (*ShardedMap[K, V]) Len ¶
func (s *ShardedMap[K, V]) Len() int
func (*ShardedMap[K, V]) Load ¶
func (s *ShardedMap[K, V]) Load(key K) (value V, ok bool)
func (*ShardedMap[K, V]) Store ¶
func (s *ShardedMap[K, V]) Store(key K, value V)
Click to show internal directories.
Click to hide internal directories.