Wrapper class that indicates subtypes of X are discriminated by type D
using the supplied Codec[D].
For example, an implicit Discriminated value can be defined in the companion
of a sealed trait, along with implicit Discriminator values in each subtype
companion. Given such implicits, a codec for the trait can be automatically
derived using Codec[X].
Contains an optional codec transformation, which is applied to every
component codec before encoding/decoding. This allows common structure,
e.g., size based framing, to be specified in one location.
For example, if each discriminated subtype is prefixed by a size field,
the framing could be specified as:
Discriminated[X, D](uint, new CodecTransformation {
def apply[Z](c: Codec[Z]) = variableSizeBytes(uint16, c)
})
X
type that can be discriminated by discriminator values of type D
D
value type that discriminates Y in context of X from other types
using discriminators of D for some type Y
This member is added by an implicit conversion from Discriminated[X, D] to
any2stringadd[Discriminated[X, D]] performed by method any2stringadd in scala.Predef.
This member is added by an implicit conversion from Discriminated[X, D] to
ArrowAssoc[Discriminated[X, D]] performed by method ArrowAssoc in scala.Predef.
This member is added by an implicit conversion from Discriminated[X, D] to
StringFormat[Discriminated[X, D]] performed by method StringFormat in scala.Predef.
This member is added by an implicit conversion from Discriminated[X, D] to
ArrowAssoc[Discriminated[X, D]] performed by method ArrowAssoc in scala.Predef.
Wrapper class that indicates subtypes of
X
are discriminated by typeD
using the suppliedCodec[D]
.For example, an implicit
Discriminated
value can be defined in the companion of a sealed trait, along with implicitDiscriminator
values in each subtype companion. Given such implicits, a codec for the trait can be automatically derived usingCodec[X]
.Contains an optional codec transformation, which is applied to every component codec before encoding/decoding. This allows common structure, e.g., size based framing, to be specified in one location.
For example, if each discriminated subtype is prefixed by a size field, the framing could be specified as:
type that can be discriminated by discriminator values of type
D
value type that discriminates
Y
in context ofX
from other types using discriminators ofD
for some typeY