Gets an implicitly available codec for type A
.
Gets an implicitly available codec for type A
.
If an implicit Codec[A]
is not available, one might be able to be derived automatically.
Codecs can be derived for:
A
, has an implicitly available Discriminated[A, D]
for some D
X
has an implicitly available Discriminator[A, X, D]
Creates a codec from an encoder and a decoder.
Creates a codec from encoder and decoder functions.
Creates a decoder that decodes with each of the specified decoders, returning the first successful result.
Creates a decoder that decodes with each of the specified decoders, returning the first successful result.
Creates an encoder that encodes with each of the specified encoders, returning the first successful result.
Creates an encoder that encodes with each of the specified encoders, returning the first successful result.
Creates a coproduct codec builder for the specified type.
Creates a coproduct codec builder for the specified type.
Support exists for coproducts and unions. Each component type must have an implicitly available codec.
For example:
type C = Foo :+: Bar :+: Baz :+: CNil val codec = Codec.coproduct[C].choice codec.encode(Coproduct[C](Foo(...)))
Decodes the specified bit vector in to a value of type A
using an implicitly available codec.
Repeatedly decodes values of type A
from the specified vector, converts each value to a B
and appends it to an accumulator of type
B
using the supplied zero
value and append
function.
Repeatedly decodes values of type A
from the specified vector, converts each value to a B
and appends it to an accumulator of type
B
using the supplied zero
value and append
function. Terminates when no more bits are available in the vector. Exits upon first decoding error.
tuple consisting of the terminating error if any and the accumulated value
Decodes a tuple (A, B)
by first decoding A
and then using the remaining bits to decode B
.
Decodes a tuple (A, B)
by first decoding A
and then using the remaining bits to decode B
.
Decodes a C
by first decoding A
and then using the remaining bits to decode B
, then applying the decoded values to the specified function to generate a C
.
Decodes a C
by first decoding A
and then using the remaining bits to decode B
, then applying the decoded values to the specified function to generate a C
.
Repeatedly decodes values of type A
from the specified vector and returns a collection of the specified type.
Repeatedly decodes values of type A
from the specified vector and returns a collection of the specified type.
Terminates when no more bits are available in the vector or when limit
is defined and that many records have been
decoded. Exits upon first decoding error.
Supports derived codecs.
Supports derived codecs.
Supports derived codecs.
Supports derived codecs.
Supports derived codecs.
Encodes the specified value to a bit vector using an implicitly available codec.
Encodes the specified values, one after the other, to a bit vector using the specified encoders.
Encodes the specified values, one after the other, to a bit vector using the specified encoders.
Encodes all elements of the specified sequence and concatenates the results, or returns the first encountered error.
Encodes all elements of the specified sequence and concatenates the results, or returns the first encountered error.
Transform typeclass instance.
Companion for Codec.