Wrapper

zio.blocks.schema.binding.Binding.Wrapper
final case class Wrapper[A, B](wrap: B => A, unwrap: A => B) extends Binding[Wrapper[A, B], 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
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Binding[Wrapper[A, B], A]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
Source
Product.scala
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
Source
Product.scala