The binding kinds, ready-made bindings for standard types, and Binding.of, which derives a binding at compile time.
Attributes
- Companion
- trait
- Source
- Binding.scala
- Graph
-
- Supertypes
- Self type
-
Binding.type
Members list
Type members
Classlikes
The binding of a dynamic node, which holds a zio.blocks.schema.DynamicValue as it is. It is a marker without data, and all instances are equal.
The binding of a dynamic node, which holds a zio.blocks.schema.DynamicValue as it is. It is a marker without data, and all instances are equal.
Attributes
- Source
- Binding.scala
- Supertypes
The binding of a map node for the map type constructor M: constructor builds an M[K, V] entry by entry, and deconstructor reads one back as its entries. Neither depends on K or V, so one binding serves every key and value type.
The binding of a map node for the map type constructor M: constructor builds an M[K, V] entry by entry, and deconstructor reads one back as its entries. Neither depends on K or V, so one binding serves every key and value type.
Attributes
- Companion
- object
- Source
- Binding.scala
- Supertypes
Map bindings for the standard maps.
Map bindings for the standard maps.
Attributes
- Companion
- class
- Source
- Binding.scala
- Supertypes
- Self type
-
Map.type
The binding of a primitive node. It is a marker without data: a primitive value is read and written as it is, so there is nothing to construct. All instances are equal. The companion object has one for each of the 30 primitive types.
The binding of a primitive node. It is a marker without data: a primitive value is read and written as it is, so there is nothing to construct. All instances are equal. The companion object has one for each of the 30 primitive types.
Attributes
- Companion
- object
- Source
- Binding.scala
- Supertypes
The primitive bindings, one per primitive type.
The primitive bindings, one per primitive type.
Attributes
- Companion
- class
- Source
- Binding.scala
- Supertypes
- Self type
-
Primitive.type
The binding of a record node, such as a case class. constructor builds a value from Registers, and deconstructor writes a value's fields into them.
The binding of a record node, such as a case class. constructor builds a value from Registers, and deconstructor writes a value's fields into them.
Both must use the layout that Reflect.Record#registers computes from the node's fields. In field order, a field stored as a Boolean, Byte, Short, Char, Int, Float, Long or Double takes the next position of its size in the byte area, a Unit field takes no space, and every other field takes the next object slot (see Register). Reflect.Record#fromDynamicValue and #toDynamicValue move each field through that layout, so a binding with a different layout reads the wrong registers.
Attributes
- Companion
- object
- Source
- Binding.scala
- Supertypes
Record bindings for Option, Either and Maybe cases.
Record bindings for Option, Either and Maybe cases.
Attributes
- Companion
- class
- Source
- Binding.scala
- Supertypes
- Self type
-
Record.type
The binding of a sequence node for the collection type constructor C: constructor builds a C[A] element by element, and deconstructor reads one back as its elements and size. Neither depends on the element type A, so one binding serves every element type, which is why BindingResolver stores sequence bindings by C alone.
The binding of a sequence node for the collection type constructor C: constructor builds a C[A] element by element, and deconstructor reads one back as its elements and size. Neither depends on the element type A, so one binding serves every element type, which is why BindingResolver stores sequence bindings by C alone.
Attributes
- Companion
- object
- Source
- Binding.scala
- Supertypes
Sequence bindings for the standard collections.
Sequence bindings for the standard collections.
Attributes
- Companion
- class
- Source
- Binding.scala
- Supertypes
- Self type
-
Seq.type
The binding of a variant node, such as a sealed trait or an enum. discriminator returns the index of the case that a value belongs to, and matchers holds one Matcher per case. Both follow the order of the node's cases: case i of the node is matched by matchers(i), and its values are discriminated as i.
The binding of a variant node, such as a sealed trait or an enum. discriminator returns the index of the case that a value belongs to, and matchers holds one Matcher per case. Both follow the order of the node's cases: case i of the node is matched by matchers(i), and its values are discriminated as i.
Attributes
- Companion
- object
- Source
- Binding.scala
- Supertypes
Variant bindings for Option, Either and Maybe.
Variant bindings for Option, Either and Maybe.
Attributes
- Companion
- class
- Source
- Binding.scala
- Supertypes
- Self type
-
Variant.type
The binding of a wrapper node, which stores a value of type A as the value of type B inside it, such as a newtype or the result of Schema#transform. wrap builds an A from a B, and unwrap returns the B inside an A.
The binding of a wrapper node, which stores a value of type A as the value of type B inside it, such as a newtype or the result of Schema#transform. wrap builds an A from a B, and unwrap returns the B inside an A.
wrap rejects a B by throwing. Reflect#fromDynamicValue and the JSON codec catch a non-fatal exception from it and report it as a decoding error.
Type parameters
- A
-
the wrapper type
- B
-
the wrapped type
Attributes
- Source
- Binding.scala
- Supertypes
Inherited and Abstract types
The names of the product elements.
The name of the type.
Value members
Inherited methods
Creates a Binding.Map for a map type constructor from the implicit MapConstructor and MapDeconstructor instances. The resulting binding has key and value types Nothing, which upcast via covariance.
Creates a Binding.Map for a map type constructor from the implicit MapConstructor and MapDeconstructor instances. The resulting binding has key and value types Nothing, which upcast via covariance.
Type parameters
- M
-
the map type constructor (e.g., Map)
Attributes
- Inherited from:
- BindingCompanionVersionSpecific
- Source
- BindingCompanionVersionSpecific.scala
Creates a Binding.Seq for a sequence type constructor from the implicit SeqConstructor and SeqDeconstructor instances. The resulting binding has element type Nothing, which upcasts to any element type via covariance.
Creates a Binding.Seq for a sequence type constructor from the implicit SeqConstructor and SeqDeconstructor instances. The resulting binding has element type Nothing, which upcasts to any element type via covariance.
Type parameters
- F
-
the sequence type constructor (e.g., List, Vector)
Attributes
- Inherited from:
- BindingCompanionVersionSpecific
- Source
- BindingCompanionVersionSpecific.scala
Derives a Binding for type A at compile time.
Derives a Binding for type A at compile time.
Supports:
- Primitive types (Int, String, Boolean, etc.)
- Case classes and tuples (derives Binding.Record)
- Case objects and enum cases without parameters (derives a Binding.Record that always returns the object)
- Sealed traits, sealed abstract classes and enums (derives Binding.Variant)
- Option, Either, and their subtypes
- zio.blocks.schema.DynamicValue
- A class with one field whose companion has an
applyfrom the field's type toEither[E, A](derives a Binding.Wrapper whosewrapcallsapplyand throws aSchemaErroron aLeft) - Structural types, on the JVM only
- zio-prelude newtypes (derives Binding.Wrapper)
- On Scala 3 only: named tuples (derives Binding.Record), union types (derives Binding.Variant, with the cases sorted by the full name of each case's type, not in the order the union is written) and opaque types (derives Binding.Wrapper)
On Scala 3, a structural record type needs a build of this library with Scala 3.5 or later; a union of structural types does not. Both Scala 3 artifacts are such builds (zio-blocks-schema with Scala 3.9, zio-blocks-next-schema with Scala 3.10). (In 0.0.56, zio-blocks-schema was built with Scala 3.3 and rejected structural record types at compile time.)
For sequence types (List, Vector, etc.) and map types, use the overloads that take type constructors: Binding.of[List], Binding.of[Map]; Binding.of[List[Int]] does not compile.
Type parameters
- A
-
the type to derive a binding for
Attributes
- Returns
-
the derived binding
- Inherited from:
- BindingCompanionVersionSpecific
- Source
- BindingCompanionVersionSpecific.scala
Implicits
Implicits
The FromBinding instance for Binding itself, which returns the binding unchanged.
The FromBinding instance for Binding itself, which returns the binding unchanged.
Attributes
- Source
- Binding.scala
The HasBinding instance for Binding itself: binding returns its argument, and updateBinding applies the function to it.
The HasBinding instance for Binding itself: binding returns its argument, and updateBinding applies the function to it.
Attributes
- Source
- Binding.scala