MapConstructor

zio.blocks.schema.binding.MapConstructor
See theMapConstructor companion object
trait MapConstructor[M[_, _]]

Builds a map of type M[K, V] entry by entry through a mutable builder: the construction half of a Binding.Map. A codec decodes a map by calling newObjectBuilder, addObject for each entry, and then resultObject.

Type parameters

M

the map type constructor

Attributes

Companion
object
Source
MapConstructor.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Type members

Types

type ObjectBuilder[_, _]

The mutable builder that collects the entries.

The mutable builder that collects the entries.

Attributes

Source
MapConstructor.scala

Value members

Abstract methods

def addObject[K, V](builder: ObjectBuilder[K, V], k: K, v: V): Unit

Adds the entry k -> v to builder. For chunkMap and map, a later entry with the same key replaces an earlier one.

Adds the entry k -> v to builder. For chunkMap and map, a later entry with the same key replaces an earlier one.

Attributes

Source
MapConstructor.scala
def emptyObject[K, V]: M[K, V]

Returns an empty map.

Returns an empty map.

Attributes

Source
MapConstructor.scala
def newObjectBuilder[K, V](sizeHint: Int = ...): ObjectBuilder[K, V]

Creates an empty builder. sizeHint is the expected number of entries; chunkMap passes it to its builder, and map ignores it.

Creates an empty builder. sizeHint is the expected number of entries; chunkMap passes it to its builder, and map ignores it.

Attributes

Source
MapConstructor.scala
def resultObject[K, V](builder: ObjectBuilder[K, V]): M[K, V]

Returns the map built from the entries added to builder.

Returns the map built from the entries added to builder.

Attributes

Source
MapConstructor.scala
def updated[K, V](map: M[K, V], key: K, value: V): M[K, V]

Returns map with key bound to value, replacing an existing binding of key.

Returns map with key bound to value, replacing an existing binding of key.

Attributes

Source
MapConstructor.scala