Documentation
¶
Overview ¶
Package c provides common types of containers, utility types and functions
Index ¶
- type Access
- type Addable
- type AddableAll
- type AddableAllNew
- type AddableNew
- type Checkable
- type Collection
- type Convertable
- type Deleteable
- type DeleteableVerify
- type Filterable
- type ForEach
- type ImmutableMapConvert
- type Iterator
- type KV
- type KVRange
- type KeyVal
- type Keys
- type MapFactory
- type OrderedRange
- type Range
- type Removable
- type Settable
- type SettableMap
- type SettableNew
- type Sized
- type SliceFactory
- type TrackEach
- type Values
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Access ¶
Access provides access to an element by its pointer (index, key, coordinate, etc.) Where:
P - a type of pointer to a value (index, map key, coordinates) V - any arbitrary type of the value
type Addable ¶
type Addable[T any] interface { Add(...T) AddOne(T) }
Addable provides appending the collection by elements.
type AddableAll ¶ added in v0.0.7
type AddableAll[Iterable any] interface { AddAll(Iterable) }
AddableAll provides appending the collection by elements retrieved from another collection
type AddableAllNew ¶ added in v0.0.7
AddableAllNew provides appending the collection by elements retrieved from another collection
type AddableNew ¶ added in v0.0.7
AddableNew provides appending the collection by elements.
type Collection ¶
type Collection[T any] interface { Sized Range[T] ForEach[T] SliceFactory[T] Head() (T, bool) First(func(T) bool) (T, bool) Reduce(merge func(T, T) T) T HasAny(func(T) bool) bool }
Collection is the base interface of non-associative collections
type Convertable ¶ added in v0.0.7
type Convertable[T any, Seq ~func(yield func(T) bool), SeqE ~func(yield func(T, error) bool)] interface { Convert(converter func(T) T) Seq Conv(converter func(T) (T, error)) SeqE }
Convertable provides converaton of collection elements functionality
type Deleteable ¶
type Deleteable[k any] interface { Delete(...k) DeleteOne(k) }
Deleteable provides removing any elements from the collection.
type DeleteableVerify ¶ added in v0.0.7
DeleteableVerify provides removing any elements from the collection.
type Filterable ¶ added in v0.0.7
type Filterable[T any, Seq ~func(yield func(T) bool), SeqE ~func(yield func(T, error) bool)] interface { Filter(predicate func(T) bool) Seq Filt(predicate func(T) (bool, error)) SeqE }
Filterable provides filtering content functionality
type ForEach ¶ added in v0.0.12
type ForEach[T any] interface { // ForEach takes all elements of the collection ForEach(func(element T)) }
ForEach is the interface of a collection that provides traversing of the elements without error checking.
type ImmutableMapConvert ¶ added in v0.0.7
type ImmutableMapConvert[M any] interface { Immutable() M }
ImmutableMapConvert provides converting to an immutable map instance.
type Iterator ¶
type Iterator[T any] interface { // Next returns the next element. // The ok result indicates whether the element was returned by the iterator. // If ok == false, then the iteration must be completed. Next() (out T, ok bool) ForEach[T] Range[T] }
Iterator provides iterate over elements of a collection
type KVRange ¶ added in v0.0.15
KVRange provides an All function used for iterating over a sequence of key\value pairs by `for k, v := range collection.All`.
type KeyVal ¶ added in v0.0.7
KeyVal provides access to all keys and values of a key/value based collection.
type Keys ¶ added in v0.0.13
type Keys[K any] interface { Keys() K }
Keys provides access to all keys of a key/value based collection.
type MapFactory ¶ added in v0.0.7
type MapFactory[K comparable, V any, Map map[K]V | map[K][]V] interface { Map() Map }
MapFactory collects the key/value pairs of the collection into a new map
type OrderedRange ¶ added in v0.0.15
OrderedRange provides an IAll function used for iterating over an ordered sequence of elements by `for i, e := range collection.IAll`.
type Range ¶ added in v0.0.15
Range provides an All function used for iterating over a sequence of elements by `for e := range collection.All`.
type SettableMap ¶ added in v0.0.7
type SettableMap[Map any] interface { SetMap(m Map) }
SettableMap provides element insertion or replacement with an equal key element of a map.
type SettableNew ¶ added in v0.0.7
SettableNew provides element insertion by its pointer (index or key) only if the specified place is not occupied.
type Sized ¶ added in v0.0.4
type Sized interface {
// returns an estimated internal storage size or -1 if the size cannot be calculated
Len() int
}
Sized - storage interface with measurable size
type SliceFactory ¶ added in v0.0.7
type SliceFactory[T any] interface { Slice() []T Append([]T) []T }
SliceFactory collects the elements of the collection into a slice