Documentation
¶
Index ¶
- func Remap[Map ~map[KeyIn]ValueIn, EntryOut interface{ ... }, KeyIn, KeyOut comparable, ...](m Map, fn func(KeyIn, ValueIn) seqs.Seq[EntryOut]) map[KeyOut]ValueOut
- func RemapIter[Map ~map[KeyIn]ValueIn, KeyIn, KeyOut comparable, ValueIn, ValueOut any](m Map, fn func(KeyIn, ValueIn) iter.Seq2[KeyOut, ValueOut]) map[KeyOut]ValueOut
- func ToMap[Seq seqs.Seq[Entry], Entry interface{ ... }, Key comparable, Value any](seq Seq) map[Key]Value
- func ToMapWith[Seq seqs.Seq[Entry], Entry any, Key comparable, Value any, ...](seq Seq, unpack Unpack) (m map[Key]Value)
- func ZipToMap[KeySeq seqs.Seq[Key], ValueSeq seqs.Seq[Value], Key comparable, Value any](keys KeySeq, values ValueSeq) map[Key]Value
- type MapEntries
- func EntriesOf[Map Mapping[Key, Value], Key comparable, Value any](m Map) ...
- func EntriesOfWith[Map Mapping[Key, Value], Key comparable, Value any, Entry any, ...](m Map, pack Pack) MapEntries[Map, Key, Value, Entry, Pack]
- func KeysOf[M Mapping[K, V], K comparable, V any](m M) MapEntries[M, K, V, K, func(K, V) K]
- func ValuesOf[M Mapping[K, V], K comparable, V any](m M) MapEntries[M, K, V, V, func(K, V) V]
- type MapEntry
- type Mapping
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Remap ¶ added in v0.16.0
func Remap[
Map ~map[KeyIn]ValueIn,
EntryOut interface{ Unpack() (KeyOut, ValueOut) },
KeyIn, KeyOut comparable,
ValueIn, ValueOut any,
](m Map, fn func(KeyIn, ValueIn) seqs.Seq[EntryOut]) map[KeyOut]ValueOut
Remap returns a map obtained by passing entries of the specified map to the specified transformation function and folding the resulting entries into a map.
func RemapIter ¶ added in v0.16.0
func RemapIter[ Map ~map[KeyIn]ValueIn, KeyIn, KeyOut comparable, ValueIn, ValueOut any, ](m Map, fn func(KeyIn, ValueIn) iter.Seq2[KeyOut, ValueOut]) map[KeyOut]ValueOut
RemapIter is the same as Remap but the transformation function returns an iter.Seq2 instead of a seqs.Seq.
func ToMap ¶
func ToMap[ Seq seqs.Seq[Entry], Entry interface{ Unpack() (Key, Value) }, Key comparable, Value any, ](seq Seq) map[Key]Value
Types ¶
type MapEntries ¶
type MapEntries[ Map Mapping[Key, Value], Key comparable, Value any, Entry any, Pack ~func(Key, Value) Entry, ] struct { Map Map Pack Pack }
func EntriesOf ¶
func EntriesOf[ Map Mapping[Key, Value], Key comparable, Value any, ]( m Map, ) MapEntries[ Map, Key, Value, MapEntry[Key, Value], func(Key, Value) MapEntry[Key, Value], ]
func EntriesOfWith ¶
func EntriesOfWith[ Map Mapping[Key, Value], Key comparable, Value any, Entry any, Pack ~func(Key, Value) Entry, ](m Map, pack Pack) MapEntries[Map, Key, Value, Entry, Pack]
func KeysOf ¶
func KeysOf[M Mapping[K, V], K comparable, V any](m M) MapEntries[M, K, V, K, func(K, V) K]
func ValuesOf ¶
func ValuesOf[M Mapping[K, V], K comparable, V any](m M) MapEntries[M, K, V, V, func(K, V) V]
func (MapEntries[_, K, V, E, _]) ForEachWhile ¶ added in v1.0.0
func (mes MapEntries[_, K, V, E, _]) ForEachWhile(yield func(E) bool)
func (MapEntries[_, _, _, _, _]) Len ¶
func (mes MapEntries[_, _, _, _, _]) Len() int
type Mapping ¶
type Mapping[K comparable, V any] interface { ~map[K]V }
Click to show internal directories.
Click to hide internal directories.