Documentation ¶
Overview ¶
Package c provides common types of containers, utility types and functions
Index ¶
- Variables
- type Access
- type Addable
- type AddableAll
- type AddableAllNew
- type AddableNew
- type Checkable
- type Collection
- type Convertable
- type DelIterator
- type Deleteable
- type DeleteableVerify
- type Filterable
- type ForEachLoop
- type ForLoop
- type ImmutableMapConvert
- type Iterable
- type Iterator
- type KV
- type KeyVal
- type MapFactory
- type Number
- type PrevIterator
- type Quaternary
- type Removable
- type Settable
- type SettableMap
- type SettableNew
- type Sized
- type SliceFactory
- type Summable
- type TrackEachLoop
- type TrackLoop
Constants ¶
This section is empty.
Variables ¶
var ErrBreak = errors.New("Break")
ErrBreak is the 'break' statement of the For, Track methods
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 { Iterable[T] ForLoop[T] ForEachLoop[T] SliceFactory[T] Reduce(merger func(T, T) T) T }
Collection is the base interface of non-associative collections
type Convertable ¶ added in v0.0.7
type Convertable[T, Stream, StreamBreakable any] interface { Convert(converter func(T) T) Stream Conv(converter func(T) (T, error)) StreamBreakable }
Convertable provides converaton of collection elements functionality
type DelIterator ¶
DelIterator is the Iterator provides deleting of current element.
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, Stream, StreamBreakable any] interface { Filter(predicate func(T) bool) Stream Filt(predicate func(T) (bool, error)) StreamBreakable }
Filterable provides filtering content functionality
type ForEachLoop ¶ added in v0.0.7
type ForEachLoop[T any] interface { // ForEach takes all elements of the collection ForEach(func(element T)) }
ForEachLoop is the interface of a collection that provides traversing of the elements without error checking.
type ForLoop ¶ added in v0.0.7
type ForLoop[IT any] interface { //For takes elements of the collection. Can be interrupt by returning ErrBreak. For(func(element IT) error) error }
ForLoop is the interface of a collection that provides traversing of the elements.
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) ForLoop[T] ForEachLoop[T] }
Iterator provides iterate over elements of a collection
type KeyVal ¶ added in v0.0.7
KeyVal provides extracing of a keys or values collection from key/value pairs
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 map
type Number ¶ added in v0.0.3
type Number interface { constraints.Integer | constraints.Float | constraints.Complex }
Number is a type that supports the operators +, -, /, *
type PrevIterator ¶
type PrevIterator[T any] interface { Iterator[T] //retrieves a prev element and true or zero value of T and false if no more elements Prev() (T, bool) }
PrevIterator is the Iterator that provides reverse iteration over elements of a collection
type Quaternary ¶ added in v0.0.3
type Quaternary[t1, t2 any] func(t1, t2, t1, t2) (t1, t2)
Quaternary is an operation with four arguments
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 capacity or -1 if the capacity cannot be calculated Cap() int }
Sized - storage interface with measurable capacity
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
type Summable ¶ added in v0.0.3
type Summable interface { constraints.Ordered | constraints.Complex | string }
Summable is a type that supports the operator +
type TrackEachLoop ¶ added in v0.0.7
TrackEachLoop is the interface of a collection that provides traversing of the elements with position tracking (index, key, coordinates, etc.) without error checking