Documentation ¶
Overview ¶
Package Packed contains specific Array types that are more efficient and convenient to work with.
Package Packed provides functions for working with packed arrays.
Index ¶
- type Array
- func (array *Array[T]) Append(value T)
- func (array *Array[T]) AppendArray(other Array[T])
- func (array Array[T]) Bytes() Bytes
- func (array Array[T]) Clear()
- func (array Array[T]) Count(value T) int
- func (array Array[T]) Duplicate() Array[T]
- func (array Array[T]) Fill(value T)
- func (array Array[T]) Find(value T) int
- func (array Array[T]) FindLast(value T) int
- func (array Array[T]) Has(value T) bool
- func (array Array[T]) Index(idx int) T
- func (array *Array[T]) Insert(idx int, value T)
- func (array Array[T]) IsEmpty() bool
- func (array Array[T]) Iter() iter.Seq2[int, T]
- func (array Array[T]) Len() int
- func (array Array[T]) RemoveAt(idx int)
- func (array *Array[T]) Resize(size int)
- func (array Array[T]) Reverse()
- func (array *Array[T]) SetIndex(idx int, value T)
- func (array Array[T]) Slice(begin, end int) Array[T]
- func (array Array[T]) Values() iter.Seq[T]
- type Bytes
- func (array *Bytes) Append(value byte)
- func (array *Bytes) AppendArray(other Bytes)
- func (array Bytes) Bytes() []byte
- func (array Bytes) Clear()
- func (array Bytes) Count(value byte) int
- func (array Bytes) Duplicate() Bytes
- func (array Bytes) Fill(value byte)
- func (array Bytes) Find(value byte) int
- func (array Bytes) FindLast(value byte) int
- func (array Bytes) Has(value byte) bool
- func (array Bytes) Index(idx int) byte
- func (array *Bytes) Insert(idx int, value byte)
- func (array Bytes) IsEmpty() bool
- func (array Bytes) Iter() iter.Seq2[int, byte]
- func (array Bytes) Len() int
- func (array Bytes) RemoveAt(idx int)
- func (array *Bytes) Resize(size int)
- func (array Bytes) Reverse()
- func (array *Bytes) SetIndex(idx int, value byte)
- func (array Bytes) Slice(begin, end int) Bytes
- type Strings
- func (array *Strings) Append(value String.Readable)
- func (array *Strings) AppendArray(other Strings)
- func (array Strings) Clear()
- func (array Strings) Count(value String.Readable) int
- func (array Strings) Duplicate() Strings
- func (array Strings) Fill(value String.Readable)
- func (array Strings) Find(value String.Readable) int
- func (array Strings) FindLast(value String.Readable) int
- func (array Strings) Has(value String.Readable) bool
- func (array Strings) Index(idx int) String.Readable
- func (array *Strings) Insert(idx int, value String.Readable)
- func (array Strings) IsEmpty() bool
- func (array Strings) Iter() iter.Seq2[int, String.Readable]
- func (array Strings) Len() int
- func (array Strings) RemoveAt(idx int)
- func (array *Strings) Resize(size int)
- func (array Strings) Reverse()
- func (array *Strings) SetIndex(idx int, value String.Readable)
- func (array Strings) Slice(begin, end int) Strings
- func (array Strings) Strings() []string
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Array ¶
type Array[T Type] GenericArray.Contains[T]
Array contains comparable elements of type T Similar to [Array.Contains[T]] but for a supported Type is more efficient and convienient to work with.
func (*Array[T]) Append ¶
func (array *Array[T]) Append(value T)
Append an element to the end of the array.
func (*Array[T]) AppendArray ¶
AppendArray appends all elements of another array to the end of this array.
func (Array[T]) Clear ¶
func (array Array[T]) Clear()
Clear clears the array. This is equivalent to using resize with a size of 0.
func (Array[T]) Fill ¶
func (array Array[T]) Fill(value T)
Fill assigns the given value to all elements in the array. This can typically be used together with resize to create an array with a given size and initialized elements.
func (Array[T]) Find ¶
Find searches the array for a value and returns its index or -1 if not found.
func (Array[T]) FindLast ¶
FindLast searches the array in reverse order for a value and returns its index or -1 if not found.
func (*Array[T]) Insert ¶
Insert inserts a new element at a given position in the array. The position must be valid, or at the end of the array (idx == size()).
func (*Array[T]) Resize ¶
Resize sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling resize once and assigning the new values is faster than adding new elements one by one.
func (Array[T]) Reverse ¶
func (array Array[T]) Reverse()
Reverse reverses the order of the elements in the array.
type Bytes ¶
Bytes provides additional methods for working with arrays of bytes.
func (*Bytes) AppendArray ¶
AppendArray appends all elements of another array to the end of this array.
func (Bytes) Clear ¶
func (array Bytes) Clear()
Clear clears the array. bytehis is equivalent to using resize with a size of 0.
func (Bytes) Fill ¶
Fill assigns the given value to all elements in the array. bytehis can typically be used together with resize to create an array with a given size and initialized elements.
func (Bytes) FindLast ¶
FindLast searches the array in reverse order for a value and returns its index or -1 if not found.
func (*Bytes) Insert ¶
Insert inserts a new element at a given position in the array. bytehe position must be valid, or at the end of the array (idx == size()).
func (*Bytes) Resize ¶
Resize sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling resize once and assigning the new values is faster than adding new elements one by one.
func (Bytes) Reverse ¶
func (array Bytes) Reverse()
Reverse reverses the order of the elements in the array.
type Strings ¶
type Strings GenericArray.Contains[String.Readable]
Strings is a packed array of readable strings.
func MakeStrings ¶
MakeStrings creates a new array of strings with the given values.
func (*Strings) AppendArray ¶
AppendArray appends all elements of another array to the end of this array.
func (Strings) Clear ¶
func (array Strings) Clear()
Clear clears the array. String.Readablehis is equivalent to using resize with a size of 0.
func (Strings) Fill ¶
Fill assigns the given value to all elements in the array. String.Readablehis can typically be used together with resize to create an array with a given size and initialized elements.
func (Strings) FindLast ¶
FindLast searches the array in reverse order for a value and returns its index or -1 if not found.
func (*Strings) Insert ¶
Insert inserts a new element at a given position in the array. String.Readablehe position must be valid, or at the end of the array (idx == size()).
func (*Strings) Resize ¶
Resize sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling resize once and assigning the new values is faster than adding new elements one by one.
func (Strings) Reverse ¶
func (array Strings) Reverse()
Reverse reverses the order of the elements in the array.