Documentation
¶
Index ¶
- type Fixed
- func (s *Fixed[T]) Cap() int
- func (s *Fixed[T]) Clear()
- func (s *Fixed[T]) Delete(index int) bool
- func (s *Fixed[T]) DeleteFunc(predicate func(v T) bool) int
- func (s *Fixed[T]) Find(predicate func(v T) bool) (T, bool)
- func (s *Fixed[T]) FindIndex(predicate func(v T) bool) (int, bool)
- func (s *Fixed[T]) Get(index int) (T, bool)
- func (s *Fixed[T]) GoString() string
- func (s *Fixed[T]) IsFull() bool
- func (s *Fixed[T]) Len() int
- func (s *Fixed[T]) Read() iter.Seq[T]
- func (s *Fixed[T]) Set(index int, value T) bool
- func (s *Fixed[T]) SpaceLeft() int
- func (s *Fixed[T]) String() string
- func (s *Fixed[T]) TryAppend(items ...T) int
- func (s *Fixed[T]) UnsafeCap() int
- func (s *Fixed[T]) UnsafeDelete(index int) bool
- func (s *Fixed[T]) UnsafeGet(index int) (T, bool)
- func (s *Fixed[T]) UnsafeIsFull() bool
- func (s *Fixed[T]) UnsafeLen() int
- func (s *Fixed[T]) UnsafeSet(index int, value T) bool
- func (s *Fixed[T]) UnsafeSpaceLeft() int
- type FixedHashed
- func (s *FixedHashed[T]) Cap() int
- func (s *FixedHashed[T]) Clear()
- func (s *FixedHashed[T]) Delete(index int) bool
- func (s *FixedHashed[T]) DeleteFunc(predicate func(v T) bool) int
- func (s *FixedHashed[T]) Find(predicate func(v T) bool) (T, bool)
- func (s *FixedHashed[T]) FindIndex(predicate func(v T) bool) (int, bool)
- func (s *FixedHashed[T]) Get(index int) (T, bool)
- func (s *FixedHashed[T]) GoString() string
- func (s *FixedHashed[T]) HasHash(v uint64) bool
- func (s *FixedHashed[T]) IsFull() bool
- func (s *FixedHashed[T]) Len() int
- func (s *FixedHashed[T]) Read() iter.Seq[T]
- func (s *FixedHashed[T]) Rehash()
- func (s *FixedHashed[T]) Set(index int, value T) bool
- func (s *FixedHashed[T]) SpaceLeft() int
- func (s *FixedHashed[T]) String() string
- func (s *FixedHashed[T]) TryAppend(items ...T) int
- func (s *FixedHashed[T]) UnsafeCap() int
- func (s *FixedHashed[T]) UnsafeDelete(index int) bool
- func (s *FixedHashed[T]) UnsafeGet(index int) (T, bool)
- func (s *FixedHashed[T]) UnsafeIsFull() bool
- func (s *FixedHashed[T]) UnsafeLen() int
- func (s *FixedHashed[T]) UnsafeSet(index int, value T) bool
- func (s *FixedHashed[T]) UnsafeSpaceLeft() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fixed ¶
type Fixed[T any] struct { // contains filtered or unexported fields }
Fixed is a slice of constant size, that can be used to store a fixed amount of items
func (*Fixed[T]) Delete ¶
Delete will remove the item at the given index, and return if it was successful
func (*Fixed[T]) DeleteFunc ¶
DeleteFunc will remove the all item that matches the predicate, and return the amount of items removed
func (*Fixed[T]) Find ¶
Find will return the first item that matches the predicate, and if it was found
func (*Fixed[T]) FindIndex ¶
FindIndex will return the index of the first item that matches the predicate, and if it was found
func (*Fixed[T]) TryAppend ¶
TryAppend will check how much space is left, and attempt to write as much as possible from the given data into its own buffer
If you have 5 items, and there is room for 3, it will return 3, and has added 3 items to its buffer
func (*Fixed[T]) UnsafeDelete ¶
UnsafeDelete will remove the item at the given index, and return if it was successful without locking
func (*Fixed[T]) UnsafeGet ¶
UnsafeGet returns the item at the given index, and if it exists without locking
func (*Fixed[T]) UnsafeIsFull ¶
UnsafeIsFull returns if the slice is full without locking
func (*Fixed[T]) UnsafeSet ¶
UnsafeSet will set the item at the given index, and return if it was successful without locking
func (*Fixed[T]) UnsafeSpaceLeft ¶
UnsafeSpaceLeft returns the amount of space left in the slice without locking
type FixedHashed ¶
FixedHashed is a fixed size slice, that can be used to store a fixed amount of items
func NewFixedHashed ¶
func NewFixedHashed[T hash.Hashed](amount int) FixedHashed[T]
Creates a new slice of fixed sized, if its full nothing can be added
func (*FixedHashed[T]) Cap ¶
func (s *FixedHashed[T]) Cap() int
Cap returns the capacity of the slice
func (*FixedHashed[T]) Clear ¶
func (s *FixedHashed[T]) Clear()
Clear will remove all items from the slice
func (*FixedHashed[T]) Delete ¶
func (s *FixedHashed[T]) Delete(index int) bool
Delete will remove the item at the given index, and return if it was successful
func (*FixedHashed[T]) DeleteFunc ¶
func (s *FixedHashed[T]) DeleteFunc(predicate func(v T) bool) int
DeleteFunc will remove the all item that matches the predicate, and return the amount of items removed
func (*FixedHashed[T]) Find ¶
func (s *FixedHashed[T]) Find(predicate func(v T) bool) (T, bool)
Find will return the first item that matches the predicate, and if it was found
func (*FixedHashed[T]) FindIndex ¶
func (s *FixedHashed[T]) FindIndex(predicate func(v T) bool) (int, bool)
FindIndex will return the index of the first item that matches the predicate, and if it was found
func (*FixedHashed[T]) Get ¶
func (s *FixedHashed[T]) Get(index int) (T, bool)
Get returns the item at the given index, and if it exists
func (*FixedHashed[T]) GoString ¶
func (s *FixedHashed[T]) GoString() string
func (*FixedHashed[T]) HasHash ¶
func (s *FixedHashed[T]) HasHash(v uint64) bool
func (*FixedHashed[T]) IsFull ¶
func (s *FixedHashed[T]) IsFull() bool
IsFull returns if the slice is full
func (*FixedHashed[T]) Len ¶
func (s *FixedHashed[T]) Len() int
Len returns the amount of items in the slice
func (*FixedHashed[T]) Read ¶
func (s *FixedHashed[T]) Read() iter.Seq[T]
Read will return a sequence of the items in the slice
func (*FixedHashed[T]) Rehash ¶
func (s *FixedHashed[T]) Rehash()
func (*FixedHashed[T]) Set ¶
func (s *FixedHashed[T]) Set(index int, value T) bool
Set will set the item at the given index, and return if it was successful
func (*FixedHashed[T]) SpaceLeft ¶
func (s *FixedHashed[T]) SpaceLeft() int
SpaceLeft returns the amount of space left in the slice
func (*FixedHashed[T]) String ¶
func (s *FixedHashed[T]) String() string
func (*FixedHashed[T]) TryAppend ¶
func (s *FixedHashed[T]) TryAppend(items ...T) int
TryAppend will check how much space is left, and attempt to write as much as possible from the given data into its own buffer
If you have 5 items, and there is room for 3, it will return 3, and has added 3 items to its buffer
func (*FixedHashed[T]) UnsafeCap ¶
func (s *FixedHashed[T]) UnsafeCap() int
UnsafeCap returns the capacity of the slice without locking
func (*FixedHashed[T]) UnsafeDelete ¶
func (s *FixedHashed[T]) UnsafeDelete(index int) bool
UnsafeDelete will remove the item at the given index, and return if it was successful without locking
func (*FixedHashed[T]) UnsafeGet ¶
func (s *FixedHashed[T]) UnsafeGet(index int) (T, bool)
UnsafeGet returns the item at the given index, and if it exists without locking
func (*FixedHashed[T]) UnsafeIsFull ¶
func (s *FixedHashed[T]) UnsafeIsFull() bool
UnsafeIsFull returns if the slice is full without locking
func (*FixedHashed[T]) UnsafeLen ¶
func (s *FixedHashed[T]) UnsafeLen() int
UnsafeLen returns the amount of items in the slice without locking
func (*FixedHashed[T]) UnsafeSet ¶
func (s *FixedHashed[T]) UnsafeSet(index int, value T) bool
UnsafeSet will set the item at the given index, and return if it was successful without locking
func (*FixedHashed[T]) UnsafeSpaceLeft ¶
func (s *FixedHashed[T]) UnsafeSpaceLeft() int
UnsafeSpaceLeft returns the amount of space left in the slice without locking