Documentation ¶
Index ¶
- func Avg[T numeric](listOfNumbers []T) T
- func Contains[T comparable](slice []T, e T) bool
- func Equal[T comparable](a, b []T) bool
- func Max[T numeric](listOfNumbers []T) T
- func Remove[T comparable](s *[]T, elem T)
- func RemoveIdx[T comparable](s *[]T, i int)
- type Rigid
- type Slice
- func (s *Slice[T]) Add(x ...T)
- func (s *Slice[T]) Clear()
- func (s *Slice[T]) Commit(fn func(data *[]T, capacity int))
- func (s *Slice[T]) Get(idx int) *T
- func (s *Slice[T]) GetAll() []T
- func (s *Slice[T]) Len() int
- func (s *Slice[T]) MarshalCBOR() ([]byte, error)
- func (s *Slice[T]) MarshalJSON() ([]byte, error)
- func (s *Slice[T]) Take() []T
- func (s *Slice[T]) UnmarshalCBOR(data []byte) error
- func (s *Slice[T]) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Avg ¶
func Avg[T numeric](listOfNumbers []T) T
Avg returns the average of a slice of numeric values
func Contains ¶
func Contains[T comparable](slice []T, e T) bool
func Equal ¶
func Equal[T comparable](a, b []T) bool
func Max ¶
func Max[T numeric](listOfNumbers []T) T
Max returns the maximum value of a numeric slice. If the slice is empty, Max returns 0
func Remove ¶
func Remove[T comparable](s *[]T, elem T)
Remove removes first occurrence of e from slice, but changes the slice, so use only if order doesn't matter!
func RemoveIdx ¶
func RemoveIdx[T comparable](s *[]T, i int)
RemoveFromSlice removes item at index from slice, but changes the slice, so use only if order doesn't matter!
Types ¶
type Rigid ¶
type Rigid[T any, S constraints.Unsigned] struct { // contains filtered or unexported fields }
func NewSafeRigid ¶
func NewSafeRigid[T any, S constraints.Unsigned](size S) *Rigid[T, S]
type Slice ¶
type Slice[T any] struct { // contains filtered or unexported fields }
func NewSafeSlice ¶
func (*Slice[T]) MarshalCBOR ¶
func (*Slice[T]) MarshalJSON ¶
func (*Slice[T]) UnmarshalCBOR ¶
func (*Slice[T]) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.