Class

scodec.codecs

DiscriminatorCodec

Related Doc: package codecs

Permalink

final class DiscriminatorCodec[A, B] extends Codec[A] with KnownDiscriminatorType[B]

Codec that supports the binary structure tag ++ value where the tag identifies the encoding/decoding of the value.

To build an instance of this codec, call discriminated and specify the tag type via the by method. Then call one more more of the case combinators on this class.

Each of the case combinators provides two forms, one that defines a case with a single tag value and another, overloaded form that defines a case with a tag value to use in encoding and a predicate on tag value to use in decoding.

The most general case combinators are caseO and caseP (and their operator equivalents, ? and |). In addition to a tag or tag/predicate pair, the caseO combinators are defined by providing a mapping from A to Option[R], a mapping from R to A, and a Codec[R]. The case is used for encoding if the mapping from A to Option[R] returns a Some and it is used for decoding upon matching the tag value. The caseP combinators work the same but take a PartialFunction[A, R] instead of an A => Option[R].

If R is a subtype of A, then the mapping from R to A can be omitted. Hence, the subcaseO and subcaseP (and the operator equivalents, / and \) constrain R to being a subtype of A and do not take a R => A function.

Finally, the least generic case combinators are the typecase combinators which add further constraints to the subcase* combinators. Specifically, the typecase operators omit the A => Option[R] or PartialFunction[A, R] in favor of doing subtype checks. For example, the following codec is a Codec[AnyVal] that encodes a 0 if passed a Boolean and a 1 if passed an Int:

discriminated[AnyVal].by(uint8).typecase(0, bool).typecase(1, int32)

Often, the values are size-delimited -- that is, there is a size field after the tag field and before the value field. To support this, use the framing method to provide a transformation to each value codec. For example, framing(new CodecTransformation { def apply[X](c: Codec[X]) = variableSizeBytes(uint8, c) }).

Source
DiscriminatorCodec.scala
See also

discriminated

Linear Supertypes
Type Hierarchy Learn more about scaladoc diagrams
Ordering
  1. Grouped
  2. Alphabetic
  3. By inheritance
Inherited
  1. DiscriminatorCodec
  2. KnownDiscriminatorType
  3. Codec
  4. GenCodec
  5. Decoder
  6. Encoder
  7. AnyRef
  8. Any
Implicitly
  1. by Tuple2CodecSupport
  2. by EnrichedCoproductDecoder
  3. by EnrichedCoproductEncoder
  4. by ValueCodecEnrichedWithGenericSupport
  5. by ValueCodecEnrichedWithHListSupport
  6. by HListCodecEnrichedWithHListSupport
  7. by TransformSyntax
  8. by ValueEnrichedWithTuplingSupport
  9. by any2stringadd
  10. by StringFormat
  11. by Ensuring
  12. by ArrowAssoc
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. case class UnknownDiscriminator(discriminator: D, context: List[String]) extends Err with Product with Serializable

    Permalink

    Error raised when an unknown discriminator is encountered when decoding.

    Error raised when an unknown discriminator is encountered when decoding.

    Definition Classes
    KnownDiscriminatorType

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to any2stringadd[DiscriminatorCodec[A, B]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (DiscriminatorCodec[A, B], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to ArrowAssoc[DiscriminatorCodec[A, B]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. def /[R <: A](encodeTag: B, decodeTag: (B) ⇒ Boolean)(toRep: (A) ⇒ Option[R])(cr: Codec[R]): DiscriminatorCodec[A, B]

    Permalink

    Returns a new discriminator codec with a new case added for the specified tag.

    Returns a new discriminator codec with a new case added for the specified tag. Operator alias for subcaseO.

    R

    representative type that this case handles

    encodeTag

    tag value to use during encoding for this case

    decodeTag

    function that determines if this case should be used for decoding given a decoded tag

    toRep

    function used during encoding that converts an A to an Option[R]

    cr

    codec that encodes/decodes Rs

  6. def /[R <: A](tag: B)(toRep: (A) ⇒ Option[R])(cr: Codec[R]): DiscriminatorCodec[A, B]

    Permalink

    Returns a new discriminator codec with a new case added for the specified tag.

    Returns a new discriminator codec with a new case added for the specified tag. Operator alias for subcaseO.

    R

    representative type that this case handles

    tag

    tag value for this case

    toRep

    function used during encoding that converts an A to an Option[R]

    cr

    codec that encodes/decodes Rs

  7. def :+[B, LB <: HList](codec: Codec[B])(implicit prepend: shapeless.ops.hlist.Prepend.Aux[A, ::[B, HNil], LB], init: Aux[LB, A], last: Aux[LB, B]): Codec[LB]

    Permalink

    When called on a Codec[L] for some L <: HList, returns a new codec that encodes/decodes the HList L followed by a B.

    When called on a Codec[L] for some L <: HList, returns a new codec that encodes/decodes the HList L followed by a B. That is, this operator is a codec-level HList append operation.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to HListCodecEnrichedWithHListSupport[A] performed by method HListCodecEnrichedWithHListSupport in scodec. This conversion will take place only if A is a subclass of HList (A <: HList).
    Definition Classes
    HListCodecEnrichedWithHListSupport
  8. def :+:[B](left: Codec[B]): CoproductCodecBuilder[:+:[B, :+:[A, CNil]], ::[Codec[B], ::[Codec[A], HNil]], :+:[B, :+:[A, CNil]]]

    Permalink

    Supports creation of a coproduct codec.

    Supports creation of a coproduct codec. See scodec.codecs.CoproductCodecBuilder for details.

    Definition Classes
    Codec
  9. def ::[B](codecB: Codec[B]): Codec[::[B, ::[A, HNil]]]

    Permalink

    When called on a Codec[A] where A is not a subytpe of HList, creates a new codec that encodes/decodes an HList of B :: A :: HNil.

    When called on a Codec[A] where A is not a subytpe of HList, creates a new codec that encodes/decodes an HList of B :: A :: HNil. For example,

    uint8 :: utf8

    has type Codec[Int :: String :: HNil]. uint8 :: utf8 }}}

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to ValueCodecEnrichedWithHListSupport[A] performed by method ValueCodecEnrichedWithHListSupport in scodec.
    Definition Classes
    ValueCodecEnrichedWithHListSupport
  10. def ::[B](codec: Codec[B]): Codec[::[B, A]]

    Permalink

    When called on a Codec[L] for some L <: HList, returns a new codec representing Codec[B :: L].

    When called on a Codec[L] for some L <: HList, returns a new codec representing Codec[B :: L]. That is, this operator is a codec-level HList prepend operation.

    codec

    codec to prepend

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to HListCodecEnrichedWithHListSupport[A] performed by method HListCodecEnrichedWithHListSupport in scodec. This conversion will take place only if A is a subclass of HList (A <: HList).
    Definition Classes
    HListCodecEnrichedWithHListSupport
  11. def :::[K <: HList, KL <: HList, KLen <: Nat](k: Codec[K])(implicit prepend: shapeless.ops.hlist.Prepend.Aux[K, A, KL], lengthK: Aux[K, KLen], split: Aux[KL, KLen, K, A]): Codec[KL]

    Permalink

    When called on a Codec[L] for some L <: HList, returns a new codec that encodes/decodes the HList K followed by the HList L.

    When called on a Codec[L] for some L <: HList, returns a new codec that encodes/decodes the HList K followed by the HList L.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to HListCodecEnrichedWithHListSupport[A] performed by method HListCodecEnrichedWithHListSupport in scodec. This conversion will take place only if A is a subclass of HList (A <: HList).
    Definition Classes
    HListCodecEnrichedWithHListSupport
  12. def :~>:[B](codecB: Codec[B])(implicit ev: =:=[Unit, B]): Codec[::[A, HNil]]

    Permalink

    When called on a Codec[A], returns a new codec that encodes/decodes B :: A :: HNil.

    When called on a Codec[A], returns a new codec that encodes/decodes B :: A :: HNil. HList equivalent of ~>.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to ValueCodecEnrichedWithHListSupport[A] performed by method ValueCodecEnrichedWithHListSupport in scodec.
    Definition Classes
    ValueCodecEnrichedWithHListSupport
  13. def :~>:[B](codec: Codec[B])(implicit ev: =:=[Unit, B]): Codec[A]

    Permalink

    When called on a Codec[L] for some L <: HList, returns a new codec that encodes/decodes B :: L but only returns L.

    When called on a Codec[L] for some L <: HList, returns a new codec that encodes/decodes B :: L but only returns L. HList equivalent of ~>.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to HListCodecEnrichedWithHListSupport[A] performed by method HListCodecEnrichedWithHListSupport in scodec. This conversion will take place only if A is a subclass of HList (A <: HList).
    Definition Classes
    HListCodecEnrichedWithHListSupport
  14. final def <~[B](codecB: Codec[B])(implicit ev: =:=[Unit, B]): Codec[A]

    Permalink

    Assuming B is Unit, creates a Codec[A] that: encodes the A followed by a unit; decodes an A followed by a unit and discards the decoded unit.

    Assuming B is Unit, creates a Codec[A] that: encodes the A followed by a unit; decodes an A followed by a unit and discards the decoded unit.

    Operator alias of dropRight.

    Definition Classes
    Codec
  15. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  16. def >>:~[L <: HList](f: (A) ⇒ Codec[L]): Codec[::[A, L]]

    Permalink

    Creates a new codec that encodes/decodes an HList type of A :: L given a function A => Codec[L].

    Creates a new codec that encodes/decodes an HList type of A :: L given a function A => Codec[L]. This allows later parts of an HList codec to be dependent on earlier values. Operator alias for flatPrepend.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to ValueCodecEnrichedWithHListSupport[A] performed by method ValueCodecEnrichedWithHListSupport in scodec.
    Definition Classes
    ValueCodecEnrichedWithHListSupport
  17. final def >>~[B](f: (A) ⇒ Codec[B]): Codec[(A, B)]

    Permalink

    Returns a new codec that encodes/decodes a value of type (A, B) where the codec of B is dependent on A.

    Returns a new codec that encodes/decodes a value of type (A, B) where the codec of B is dependent on A. Operator alias for flatZip.

    Definition Classes
    Codec
  18. def ?[R](encodeTag: B, decodeTag: (B) ⇒ Boolean)(toRep: (A) ⇒ Option[R])(fromRep: (R) ⇒ A)(cr: Codec[R]): DiscriminatorCodec[A, B]

    Permalink

    Returns a new discriminator codec with a new case added for the specified tag.

    Returns a new discriminator codec with a new case added for the specified tag. Operator alias for caseO.

    R

    representative type that this case handles

    encodeTag

    tag value to use during encoding for this case

    decodeTag

    function that determines if this case should be used for decoding given a decoded tag

    toRep

    function used during encoding that converts an A to an Option[R]

    fromRep

    function used during decoding that converts an R to an A

    cr

    codec that encodes/decodes Rs

  19. def ?[R](tag: B)(toRep: (A) ⇒ Option[R])(fromRep: (R) ⇒ A)(cr: Codec[R]): DiscriminatorCodec[A, B]

    Permalink

    Returns a new discriminator codec with a new case added for the specified tag.

    Returns a new discriminator codec with a new case added for the specified tag. Operator alias for caseO.

    R

    representative type that this case handles

    tag

    tag value for this case

    toRep

    function used during encoding that converts an A to an Option[R]

    fromRep

    function used during decoding that converts an R to an A

    cr

    codec that encodes/decodes Rs

  20. def \[R <: A](encodeTag: B, decodeTag: (B) ⇒ Boolean)(toRep: PartialFunction[A, R])(cr: Codec[R]): DiscriminatorCodec[A, B]

    Permalink

    Returns a new discriminator codec with a new case added for the specified tag.

    Returns a new discriminator codec with a new case added for the specified tag. Operator alias for subcaseP.

    R

    representative type that this case handles

    encodeTag

    tag value to use during encoding for this case

    decodeTag

    function that determines if this case should be used for decoding given a decoded tag

    toRep

    partial function from A to R used during encoding

    cr

    codec that encodes/decodes Rs

  21. def \[R <: A](tag: B)(toRep: PartialFunction[A, R])(cr: Codec[R]): DiscriminatorCodec[A, B]

    Permalink

    Returns a new discriminator codec with a new case added for the specified tag.

    Returns a new discriminator codec with a new case added for the specified tag. Operator alias for subcaseP.

    R

    representative type that this case handles

    tag

    tag value for this case

    toRep

    partial function from A to R used during encoding

    cr

    codec that encodes/decodes Rs

  22. val a: DiscriminatorCodec[A, B]

    Permalink
    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to ValueEnrichedWithTuplingSupport[DiscriminatorCodec[A, B]] performed by method ValueEnrichedWithTuplingSupport in scodec.codecs.
    Definition Classes
    ValueEnrichedWithTuplingSupport
  23. def as[B](implicit as: Transformer[A, B]): Codec[B]

    Permalink

    Transforms using implicitly available evidence that such a transformation is possible.

    Transforms using implicitly available evidence that such a transformation is possible.

    Typical transformations include converting:

    • an F[L] for some L <: HList to/from an F[CC] for some case class CC, where the types in the case class are aligned with the types in L
    • an F[C] for some C <: Coproduct to/from an F[SC] for some sealed class SC, where the component types in the coproduct are the leaf subtypes of the sealed class.
    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to TransformSyntax[Codec, A] performed by method TransformSyntax in scodec.
    Definition Classes
    TransformSyntax
  24. def asDecoder: Decoder[A]

    Permalink

    Gets this as a Decoder.

    Gets this as a Decoder.

    Definition Classes
    Decoder
  25. def asEncoder: Encoder[A]

    Permalink

    Gets this as an Encoder.

    Gets this as an Encoder.

    Definition Classes
    Encoder
  26. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  27. def caseO[R](encodeTag: B, decodeTag: (B) ⇒ Boolean)(toRep: (A) ⇒ Option[R])(fromRep: (R) ⇒ A)(cr: Codec[R]): DiscriminatorCodec[A, B]

    Permalink

    Returns a new discriminator codec with a new case added for the specified tag.

    Returns a new discriminator codec with a new case added for the specified tag.

    R

    representative type that this case handles

    encodeTag

    tag value to use during encoding for this case

    decodeTag

    function that determines if this case should be used for decoding given a decoded tag

    toRep

    function used during encoding that converts an A to an Option[R]

    fromRep

    function used during decoding that converts an R to an A

    cr

    codec that encodes/decodes Rs

  28. def caseO[R](tag: B)(toRep: (A) ⇒ Option[R])(fromRep: (R) ⇒ A)(cr: Codec[R]): DiscriminatorCodec[A, B]

    Permalink

    Returns a new discriminator codec with a new case added for the specified tag.

    Returns a new discriminator codec with a new case added for the specified tag.

    R

    representative type that this case handles

    tag

    tag value for this case

    toRep

    function used during encoding that converts an A to an Option[R]

    fromRep

    function used during decoding that converts an R to an A

    cr

    codec that encodes/decodes Rs

  29. def caseP[R](encodeTag: B, decodeTag: (B) ⇒ Boolean)(toRep: PartialFunction[A, R])(fromRep: (R) ⇒ A)(cr: Codec[R]): DiscriminatorCodec[A, B]

    Permalink

    Returns a new discriminator codec with a new case added for the specified tag.

    Returns a new discriminator codec with a new case added for the specified tag.

    R

    representative type that this case handles

    encodeTag

    tag value to use during encoding for this case

    decodeTag

    function that determines if this case should be used for decoding given a decoded tag

    toRep

    partial function from A to R used during encoding

    fromRep

    function used during decoding that converts an R to an A

    cr

    codec that encodes/decodes Rs

  30. def caseP[R](tag: B)(toRep: PartialFunction[A, R])(fromRep: (R) ⇒ A)(cr: Codec[R]): DiscriminatorCodec[A, B]

    Permalink

    Returns a new discriminator codec with a new case added for the specified tag.

    Returns a new discriminator codec with a new case added for the specified tag.

    R

    representative type that this case handles

    tag

    tag value for this case

    toRep

    partial function from A to R used during encoding

    fromRep

    function used during decoding that converts an R to an A

    cr

    codec that encodes/decodes Rs

  31. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def compact: Codec[A]

    Permalink

    Converts this codec to a new codec that compacts the encoded bit vector before returning it.

    Converts this codec to a new codec that compacts the encoded bit vector before returning it.

    Definition Classes
    CodecGenCodecEncoder
  33. final def complete: Codec[A]

    Permalink

    Converts this codec to a new codec that fails decoding if there are remaining bits.

    Converts this codec to a new codec that fails decoding if there are remaining bits.

    Definition Classes
    CodecGenCodecDecoder
  34. final def consume[B](f: (A) ⇒ Codec[B])(g: (B) ⇒ A): Codec[B]

    Permalink

    Similar to flatZip except the A type is not visible in the resulting type -- the binary effects of the Codec[A] still occur though.

    Similar to flatZip except the A type is not visible in the resulting type -- the binary effects of the Codec[A] still occur though.

    Example usage:

    case class Flags(x: Boolean, y: Boolean, z: Boolean)
    (bool :: bool :: bool :: ignore(5)).consume { flgs =>
      conditional(flgs.x, uint8) :: conditional(flgs.y, uint8) :: conditional(flgs.z, uint8)
    } {
      case x :: y :: z :: HNil => Flags(x.isDefined, y.isDefined, z.isDefined) }
    }

    Note that when B is an HList, this method is equivalent to using flatPrepend and derive. That is, a.consume(f)(g) === a.flatPrepend(f).derive[A].from(g).

    Definition Classes
    Codec
  35. def contramap[C](f: (C) ⇒ A): GenCodec[C, A]

    Permalink

    Converts this GenCodec to a GenCodec[C, B] using the supplied C => A.

    Converts this GenCodec to a GenCodec[C, B] using the supplied C => A.

    Definition Classes
    GenCodecEncoder
  36. def decode(bits: BitVector): Attempt[DecodeResult[A]]

    Permalink

    Attempts to decode a value of type A from the specified bit vector.

    Attempts to decode a value of type A from the specified bit vector.

    bits

    bits to decode

    returns

    error if value could not be decoded or the remaining bits and the decoded value

    Definition Classes
    DiscriminatorCodecDecoder
  37. def decodeOnly[AA >: A]: Codec[AA]

    Permalink

    Converts this to a codec that fails encoding with an error.

    Converts this to a codec that fails encoding with an error.

    Definition Classes
    CodecDecoder
  38. final def decodeValue(bits: BitVector): Attempt[A]

    Permalink

    Attempts to decode a value of type A from the specified bit vector and discards the remaining bits.

    Attempts to decode a value of type A from the specified bit vector and discards the remaining bits.

    bits

    bits to decode

    returns

    error if value could not be decoded or the decoded value

    Definition Classes
    Decoder
  39. def derive[A]: DeriveHListElementAux[A, A]

    Permalink

    Supports building a Codec[M] for some HList M where M is the HList that results in removing the first A from L.

    Supports building a Codec[M] for some HList M where M is the HList that results in removing the first A from L.

    Example usage:

    case class Flags(x: Boolean, y: Boolean, z: Boolean)
    val c = (bool :: bool :: bool :: ignore(5)).flatPrepend { flgs =>
      conditional(flgs.x, uint8) :: conditional(flgs.y, uint8) :: conditional(flgs.z, uint8)
    }
    c.derive[Flags].from { case x :: y :: z :: HNil => Flags(x.isDefined, y.isDefined, z.isDefined) }

    This codec, the Codec[L], is used for encoding/decoding. When decoding, the first value of type A is removed from the HList.

    When encoding, the returned codec computes an A value using the supplied function and inserts the computed A in to the HList M, yielding an HList L. That HList L is then encoded using the original codec.

    This method is called derive because the value of type A is derived from the other fields in the HList L.

    A

    type to remove from L and derive from the resulting list

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to HListCodecEnrichedWithHListSupport[A] performed by method HListCodecEnrichedWithHListSupport in scodec. This conversion will take place only if A is a subclass of HList (A <: HList).
    Definition Classes
    HListCodecEnrichedWithHListSupport
  40. final def downcast[B <: A](implicit tb: Typeable[B]): Codec[B]

    Permalink

    Safely lifts this codec to a codec of a subtype.

    Safely lifts this codec to a codec of a subtype.

    When a supertype of B that is not a supertype of A is decoded, an decoding error is returned.

    Definition Classes
    Codec
  41. final def dropLeft[B](codecB: Codec[B])(implicit ev: =:=[Unit, A]): Codec[B]

    Permalink

    Assuming A is Unit, creates a Codec[B] that: encodes the unit followed by a B; decodes a unit followed by a B and discards the decoded unit.

    Assuming A is Unit, creates a Codec[B] that: encodes the unit followed by a B; decodes a unit followed by a B and discards the decoded unit.

    Definition Classes
    Codec
  42. final def dropRight[B](codecB: Codec[B])(implicit ev: =:=[Unit, B]): Codec[A]

    Permalink

    Assuming B is Unit, creates a Codec[A] that: encodes the A followed by a unit; decodes an A followed by a unit and discards the decoded unit.

    Assuming B is Unit, creates a Codec[A] that: encodes the A followed by a unit; decodes an A followed by a unit and discards the decoded unit.

    Definition Classes
    Codec
  43. def dropUnits[M <: HList](implicit du: Aux[A, M]): Codec[M]

    Permalink

    Creates a new codec with all unit values filtered out.

    Creates a new codec with all unit values filtered out.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to HListCodecEnrichedWithHListSupport[A] performed by method HListCodecEnrichedWithHListSupport in scodec. This conversion will take place only if A is a subclass of HList (A <: HList).
    Definition Classes
    HListCodecEnrichedWithHListSupport
  44. def econtramap[C](f: (C) ⇒ Attempt[A]): GenCodec[C, A]

    Permalink

    Converts this GenCodec to a GenCodec[C, B] using the supplied C => Attempt[A].

    Converts this GenCodec to a GenCodec[C, B] using the supplied C => Attempt[A].

    Definition Classes
    GenCodecEncoder
  45. def emap[C](f: (A) ⇒ Attempt[C]): GenCodec[A, C]

    Permalink

    Converts this GenCodec to a GenCodec[A, C] using the supplied B => Attempt[C].

    Converts this GenCodec to a GenCodec[A, C] using the supplied B => Attempt[C].

    Definition Classes
    GenCodecDecoder
  46. def encode(a: A): Attempt[BitVector]

    Permalink

    Attempts to encode the specified value in to a bit vector.

    Attempts to encode the specified value in to a bit vector.

    returns

    error or binary encoding of the value

    Definition Classes
    DiscriminatorCodecEncoder
  47. def encodeOnly: Codec[A]

    Permalink

    Converts this to a codec that fails decoding with an error.

    Converts this to a codec that fails decoding with an error.

    Definition Classes
    Encoder
  48. def ensuring(cond: (DiscriminatorCodec[A, B]) ⇒ Boolean, msg: ⇒ Any): DiscriminatorCodec[A, B]

    Permalink
    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to Ensuring[DiscriminatorCodec[A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  49. def ensuring(cond: (DiscriminatorCodec[A, B]) ⇒ Boolean): DiscriminatorCodec[A, B]

    Permalink
    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to Ensuring[DiscriminatorCodec[A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  50. def ensuring(cond: Boolean, msg: ⇒ Any): DiscriminatorCodec[A, B]

    Permalink
    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to Ensuring[DiscriminatorCodec[A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  51. def ensuring(cond: Boolean): DiscriminatorCodec[A, B]

    Permalink
    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to Ensuring[DiscriminatorCodec[A, B]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  52. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  53. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  54. final def exmap[B](f: (A) ⇒ Attempt[B], g: (B) ⇒ Attempt[A]): Codec[B]

    Permalink

    Transforms using two functions, A => Attempt[B] and B => Attempt[A].

    Transforms using two functions, A => Attempt[B] and B => Attempt[A].

    Definition Classes
    Codec
  55. def exmapc[B](f: (A) ⇒ Attempt[B])(g: (B) ⇒ Attempt[A]): Codec[B]

    Permalink

    Curried version of exmap.

    Curried version of exmap.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to TransformSyntax[Codec, A] performed by method TransformSyntax in scodec.
    Definition Classes
    TransformSyntax
  56. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  57. def flatAppend[A, LA <: HList, Len <: Nat](f: (A) ⇒ Codec[A])(implicit prepend: shapeless.ops.hlist.Prepend.Aux[A, ::[A, HNil], LA], length: Aux[A, Len], split: Aux[LA, Len, A, ::[A, HNil]]): Codec[LA]

    Permalink

    When called on a Codec[L] for some L <: HList, returns a new codec that encodes/decodes the HList L followed by the value A, where the latter is encoded/decoded with the codec returned from applying L to f.

    When called on a Codec[L] for some L <: HList, returns a new codec that encodes/decodes the HList L followed by the value A, where the latter is encoded/decoded with the codec returned from applying L to f.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to HListCodecEnrichedWithHListSupport[A] performed by method HListCodecEnrichedWithHListSupport in scodec. This conversion will take place only if A is a subclass of HList (A <: HList).
    Definition Classes
    HListCodecEnrichedWithHListSupport
  58. def flatConcat[M <: HList, LM <: HList, LLen <: Nat](f: (A) ⇒ Codec[M])(implicit prepend: shapeless.ops.hlist.Prepend.Aux[A, M, LM], lengthK: Aux[A, LLen], split: Aux[LM, LLen, A, M]): Codec[LM]

    Permalink

    When called on a Codec[L] for some L <: HList, returns a new codec that encodes/decodes the HList L followed by the HList M, where the latter is encoded/decoded with the codec returned from applying L to f.

    When called on a Codec[L] for some L <: HList, returns a new codec that encodes/decodes the HList L followed by the HList M, where the latter is encoded/decoded with the codec returned from applying L to f.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to HListCodecEnrichedWithHListSupport[A] performed by method HListCodecEnrichedWithHListSupport in scodec. This conversion will take place only if A is a subclass of HList (A <: HList).
    Definition Classes
    HListCodecEnrichedWithHListSupport
  59. def flatMap[B](f: (A) ⇒ Decoder[B]): Decoder[B]

    Permalink

    Converts this decoder to a Decoder[B] using the supplied A => Decoder[B].

    Converts this decoder to a Decoder[B] using the supplied A => Decoder[B].

    Definition Classes
    Decoder
  60. def flatPrepend[L <: HList](f: (A) ⇒ Codec[L]): Codec[::[A, L]]

    Permalink

    Creates a new codec that encodes/decodes an HList type of A :: L given a function A => Codec[L].

    Creates a new codec that encodes/decodes an HList type of A :: L given a function A => Codec[L]. This allows later parts of an HList codec to be dependent on earlier values.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to ValueCodecEnrichedWithHListSupport[A] performed by method ValueCodecEnrichedWithHListSupport in scodec.
    Definition Classes
    ValueCodecEnrichedWithHListSupport
  61. final def flatZip[B](f: (A) ⇒ Codec[B]): Codec[(A, B)]

    Permalink

    Returns a new codec that encodes/decodes a value of type (A, B) where the codec of B is dependent on A.

    Returns a new codec that encodes/decodes a value of type (A, B) where the codec of B is dependent on A.

    Definition Classes
    Codec
  62. def flatZipHList[B](f: (A) ⇒ Codec[B]): Codec[::[A, ::[B, HNil]]]

    Permalink

    Creates a new codec that encodes/decodes an HList type of A :: B :: HNil given a function A => Codec[B].

    Creates a new codec that encodes/decodes an HList type of A :: B :: HNil given a function A => Codec[B]. If B is an HList type, consider using flatPrepend instead, which avoids nested HLists. This is the direct HList equivalent of flatZip.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to ValueCodecEnrichedWithHListSupport[A] performed by method ValueCodecEnrichedWithHListSupport in scodec.
    Definition Classes
    ValueCodecEnrichedWithHListSupport
  63. final def flattenLeftPairs(implicit f: FlattenLeftPairs[A]): Codec[Out]

    Permalink

    Converts this codec to an HList based codec by flattening all left nested pairs.

    Converts this codec to an HList based codec by flattening all left nested pairs. For example, flattenLeftPairs on a Codec[(((A, B), C), D)] results in a Codec[A :: B :: C :: D :: HNil]. This is particularly useful when combined with ~, ~>, and <~.

    Definition Classes
    Codec
  64. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to StringFormat[DiscriminatorCodec[A, B]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  65. def framing(framing: CodecTransformation): DiscriminatorCodec[A, B]

    Permalink

    Replaces the current framing logic with the specified codec transformation.

    Replaces the current framing logic with the specified codec transformation.

    Every representative codec is wrapped with the framing logic when encoding/decoding.

    framing

    new framing logic

  66. final def fuse[AA <: A, BB >: A](implicit ev: =:=[BB, AA]): Codec[BB]

    Permalink

    Converts this generalized codec in to a non-generalized codec assuming A and B are the same type.

    Converts this generalized codec in to a non-generalized codec assuming A and B are the same type.

    Definition Classes
    GenCodec
  67. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  68. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  69. final def hlist: Codec[::[A, HNil]]

    Permalink

    Lifts this codec in to a codec of a singleton hlist.

    Lifts this codec in to a codec of a singleton hlist.

    Definition Classes
    Codec
  70. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  71. def map[C](f: (A) ⇒ C): GenCodec[A, C]

    Permalink

    Converts this GenCodec to a GenCodec[A, C] using the supplied B => C.

    Converts this GenCodec to a GenCodec[A, C] using the supplied B => C.

    Definition Classes
    GenCodecDecoder
  72. final def narrow[B](f: (A) ⇒ Attempt[B], g: (B) ⇒ A): Codec[B]

    Permalink

    Transforms using two functions, A => Attempt[B] and B => A.

    Transforms using two functions, A => Attempt[B] and B => A.

    The supplied functions form an injection from B to A. Hence, this method converts from a larger to a smaller type. Hence, the name narrow.

    Definition Classes
    Codec
  73. def narrowc[B](f: (A) ⇒ Attempt[B])(g: (B) ⇒ A): Codec[B]

    Permalink

    Curried version of narrow.

    Curried version of narrow.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to TransformSyntax[Codec, A] performed by method TransformSyntax in scodec.
    Definition Classes
    TransformSyntax
  74. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  75. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  76. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  77. final def pairedWith[B](codecB: Codec[B]): Codec[(A, B)]

    Permalink

    Creates a Codec[(A, B)] that first encodes/decodes an A followed by a B.

    Creates a Codec[(A, B)] that first encodes/decodes an A followed by a B.

    Definition Classes
    Codec
  78. def pcontramap[C](f: (C) ⇒ Option[A]): GenCodec[C, A]

    Permalink

    Converts this GenCodec to a GenCodec[C, B] using the supplied partial function from C to A.

    Converts this GenCodec to a GenCodec[C, B] using the supplied partial function from C to A. The encoding will fail for any C that f maps to None.

    Definition Classes
    GenCodecEncoder
  79. def polyxmap[B](p: Poly, q: Poly)(implicit aToB: Aux[p.type, ::[A, HNil], B], bToA: Aux[q.type, ::[B, HNil], A]): Codec[B]

    Permalink

    Polymorphic function version of xmap.

    Polymorphic function version of xmap.

    When called on a Codec[A] where A is not a subytpe of HList, returns a new codec that's the result of xmapping with p and q, using p to convert from A to B and using q to convert from B to A.

    p

    polymorphic function that converts from A to B

    q

    polymorphic function that converts from B to A

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to ValueCodecEnrichedWithGenericSupport[A] performed by method ValueCodecEnrichedWithGenericSupport in scodec.
    Definition Classes
    ValueCodecEnrichedWithGenericSupport
  80. def polyxmap[M <: HList](p: Poly, q: Poly)(implicit lToM: Aux[p.type, A, M], mToL: Aux[q.type, M, A]): Codec[M]

    Permalink

    Polymorphic function version of xmap.

    Polymorphic function version of xmap.

    When called on a Codec[L] for some L <: HList, returns a new codec that's the result of xmapping with p and q, using p to convert from L to M and using q to convert from M to L.

    p

    polymorphic function that converts from L to M

    q

    polymorphic function that converts from M to L

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to HListCodecEnrichedWithHListSupport[A] performed by method HListCodecEnrichedWithHListSupport in scodec. This conversion will take place only if A is a subclass of HList (A <: HList).
    Definition Classes
    HListCodecEnrichedWithHListSupport
  81. def polyxmap1[B](p: Poly)(implicit aToB: Aux[p.type, ::[A, HNil], B], bToA: Aux[p.type, ::[B, HNil], A]): Codec[B]

    Permalink

    Polymorphic function version of xmap that uses a single polymorphic function in both directions.

    Polymorphic function version of xmap that uses a single polymorphic function in both directions.

    When called on a Codec[A] where A is not a subytpe of HList, returns a new codec that's the result of xmapping with p for both forward and reverse directions.

    p

    polymorphic function that converts from A to B and from B to A

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to ValueCodecEnrichedWithGenericSupport[A] performed by method ValueCodecEnrichedWithGenericSupport in scodec.
    Definition Classes
    ValueCodecEnrichedWithGenericSupport
  82. def polyxmap1[M <: HList](p: Poly)(implicit m: Aux[p.type, A, M], m2: Aux[p.type, M, A]): Codec[M]

    Permalink

    Polymorphic function version of xmap that uses a single polymorphic function in both directions.

    Polymorphic function version of xmap that uses a single polymorphic function in both directions.

    When called on a Codec[L] for some L <: HList, returns a new codec that's the result of xmapping with p for both forward and reverse directions.

    p

    polymorphic function that converts from L to M and from M to L

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to HListCodecEnrichedWithHListSupport[A] performed by method HListCodecEnrichedWithHListSupport in scodec. This conversion will take place only if A is a subclass of HList (A <: HList).
    Definition Classes
    HListCodecEnrichedWithHListSupport
  83. def selectDecoder[A](implicit sel: Selector[A, A]): Decoder[Option[A]]

    Permalink

    When called on a Decoder[C] where C is a coproduct containing type A, converts to a Decoder[Option[A]].

    When called on a Decoder[C] where C is a coproduct containing type A, converts to a Decoder[Option[A]].

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to EnrichedCoproductDecoder[A] performed by method EnrichedCoproductDecoder in scodec. This conversion will take place only if A is a subclass of Coproduct (A <: Coproduct).
    Definition Classes
    EnrichedCoproductDecoder
  84. def selectEncoder[A](implicit inj: Inject[Coproduct, A]): Encoder[A]

    Permalink

    When called on a Encoder[C] where C is a coproduct containing type A, converts to an Encoder[A].

    When called on a Encoder[C] where C is a coproduct containing type A, converts to an Encoder[A].

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to EnrichedCoproductEncoder[Coproduct] performed by method EnrichedCoproductEncoder in scodec. This conversion will take place only if A is a superclass of Coproduct (A >: Coproduct).
    Definition Classes
    EnrichedCoproductEncoder
  85. def sizeBound: SizeBound

    Permalink

    Provides a bound on the size of successfully encoded values.

    Provides a bound on the size of successfully encoded values.

    Definition Classes
    DiscriminatorCodecEncoder
  86. def subcaseO[R <: A](encodeTag: B, decodeTag: (B) ⇒ Boolean)(toRep: (A) ⇒ Option[R])(cr: Codec[R]): DiscriminatorCodec[A, B]

    Permalink

    Returns a new discriminator codec with a new case added for the specified tag.

    Returns a new discriminator codec with a new case added for the specified tag.

    R

    representative type that this case handles

    encodeTag

    tag value to use during encoding for this case

    decodeTag

    function that determines if this case should be used for decoding given a decoded tag

    toRep

    function used during encoding that converts an A to an Option[R]

    cr

    codec that encodes/decodes Rs

  87. def subcaseO[R <: A](tag: B)(toRep: (A) ⇒ Option[R])(cr: Codec[R]): DiscriminatorCodec[A, B]

    Permalink

    Returns a new discriminator codec with a new case added for the specified tag.

    Returns a new discriminator codec with a new case added for the specified tag.

    R

    representative type that this case handles

    tag

    tag value for this case

    toRep

    function used during encoding that converts an A to an Option[R]

    cr

    codec that encodes/decodes Rs

  88. def subcaseP[R <: A](encodeTag: B, decodeTag: (B) ⇒ Boolean)(toRep: PartialFunction[A, R])(cr: Codec[R]): DiscriminatorCodec[A, B]

    Permalink

    Returns a new discriminator codec with a new case added for the specified tag.

    Returns a new discriminator codec with a new case added for the specified tag.

    R

    representative type that this case handles

    encodeTag

    tag value to use during encoding for this case

    decodeTag

    function that determines if this case should be used for decoding given a decoded tag

    toRep

    partial function from A to R used during encoding

    cr

    codec that encodes/decodes Rs

  89. def subcaseP[R <: A](tag: B)(toRep: PartialFunction[A, R])(cr: Codec[R]): DiscriminatorCodec[A, B]

    Permalink

    Returns a new discriminator codec with a new case added for the specified tag.

    Returns a new discriminator codec with a new case added for the specified tag.

    R

    representative type that this case handles

    tag

    tag value for this case

    toRep

    partial function from A to R used during encoding

    cr

    codec that encodes/decodes Rs

  90. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  91. def toField[K]: Codec[FieldType[K, A]]

    Permalink

    Lifts this codec to a codec of a shapeless field -- allowing it to be used in records and unions.

    Lifts this codec to a codec of a shapeless field -- allowing it to be used in records and unions.

    Definition Classes
    Codec
  92. def toFieldWithContext[K <: Symbol](k: K): Codec[FieldType[K, A]]

    Permalink

    Lifts this codec to a codec of a shapeless field -- allowing it to be used in records and unions.

    Lifts this codec to a codec of a shapeless field -- allowing it to be used in records and unions. The specified key is pushed in to the context of any errors that are returned from the resulting codec.

    Definition Classes
    Codec
  93. def toString(): String

    Permalink
    Definition Classes
    DiscriminatorCodec → AnyRef → Any
  94. def typecase[R <: A](encodeTag: B, decodeTag: (B) ⇒ Boolean, cr: Codec[R])(implicit arg0: ClassTag[R]): DiscriminatorCodec[A, B]

    Permalink

    Returns a new discriminator codec with a new case added for the specified tag.

    Returns a new discriminator codec with a new case added for the specified tag.

    R

    representative type that this case handles

    encodeTag

    tag value to use during encoding for this case

    decodeTag

    function that determines if this case should be used for decoding given a decoded tag

    cr

    codec that encodes/decodes Rs

  95. def typecase[R <: A](tag: B, cr: Codec[R])(implicit arg0: ClassTag[R]): DiscriminatorCodec[A, B]

    Permalink

    Returns a new discriminator codec with a new case added for the specified tag.

    Returns a new discriminator codec with a new case added for the specified tag.

    R

    representative type that this case handles

    tag

    tag value for this case

    cr

    codec that encodes/decodes Rs

  96. final def unit(zero: A): Codec[Unit]

    Permalink

    Converts this to a Codec[Unit] that encodes using the specified zero value and decodes a unit value when this codec decodes an A successfully.

    Converts this to a Codec[Unit] that encodes using the specified zero value and decodes a unit value when this codec decodes an A successfully.

    Definition Classes
    Codec
  97. final def upcast[B >: A](implicit ta: Typeable[A]): Codec[B]

    Permalink

    Safely lifts this codec to a codec of a supertype.

    Safely lifts this codec to a codec of a supertype.

    When a subtype of B that is not a subtype of A is passed to encode, an encoding error is returned.

    Definition Classes
    Codec
  98. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  99. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  100. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  101. final def widen[B](f: (A) ⇒ B, g: (B) ⇒ Attempt[A]): Codec[B]

    Permalink

    Transforms using two functions, A => B and B => Attempt[A].

    Transforms using two functions, A => B and B => Attempt[A].

    The supplied functions form an injection from A to B. Hence, this method converts from a smaller to a larger type. Hence, the name widen.

    Definition Classes
    Codec
  102. def widenOpt[B](f: (A) ⇒ B, g: (B) ⇒ Option[A]): Codec[B]

    Permalink

    Transforms using two functions, A => B and B => Option[A].

    Transforms using two functions, A => B and B => Option[A].

    Particularly useful when combined with case class apply/unapply. E.g., widenOpt(fa, Foo.apply, Foo.unapply).

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to TransformSyntax[Codec, A] performed by method TransformSyntax in scodec.
    Definition Classes
    TransformSyntax
  103. def widenOptc[B](f: (A) ⇒ B)(g: (B) ⇒ Option[A]): Codec[B]

    Permalink

    Curried version of widenOpt.

    Curried version of widenOpt.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to TransformSyntax[Codec, A] performed by method TransformSyntax in scodec.
    Definition Classes
    TransformSyntax
  104. def widenc[B](f: (A) ⇒ B)(g: (B) ⇒ Attempt[A]): Codec[B]

    Permalink

    Curried version of widen.

    Curried version of widen.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to TransformSyntax[Codec, A] performed by method TransformSyntax in scodec.
    Definition Classes
    TransformSyntax
  105. final def withContext(context: String): Codec[A]

    Permalink

    Creates a new codec that is functionally equivalent to this codec but pushes the specified context string in to any errors returned from encode or decode.

    Creates a new codec that is functionally equivalent to this codec but pushes the specified context string in to any errors returned from encode or decode.

    Definition Classes
    Codec
  106. final def withToString(str: ⇒ String): Codec[A]

    Permalink

    Creates a new codec that is functionally equivalent to this codec but returns the specified string from toString.

    Creates a new codec that is functionally equivalent to this codec but returns the specified string from toString.

    Definition Classes
    Codec
  107. final def xmap[B](f: (A) ⇒ B, g: (B) ⇒ A): Codec[B]

    Permalink

    Transforms using the isomorphism described by two functions, A => B and B => A.

    Transforms using the isomorphism described by two functions, A => B and B => A.

    Definition Classes
    Codec
  108. def xmapc[B](f: (A) ⇒ B)(g: (B) ⇒ A): Codec[B]

    Permalink

    Curried version of xmap.

    Curried version of xmap.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to TransformSyntax[Codec, A] performed by method TransformSyntax in scodec.
    Definition Classes
    TransformSyntax
  109. def |[R](encodeTag: B, decodeTag: (B) ⇒ Boolean)(toRep: PartialFunction[A, R])(fromRep: (R) ⇒ A)(cr: Codec[R]): DiscriminatorCodec[A, B]

    Permalink

    Returns a new discriminator codec with a new case added for the specified tag.

    Returns a new discriminator codec with a new case added for the specified tag. Operator alias for caseP.

    R

    representative type that this case handles

    encodeTag

    tag value to use during encoding for this case

    decodeTag

    function that determines if this case should be used for decoding given a decoded tag

    toRep

    partial function from A to R used during encoding

    fromRep

    function used during decoding that converts an R to an A

    cr

    codec that encodes/decodes Rs

  110. def |[R](tag: B)(toRep: PartialFunction[A, R])(fromRep: (R) ⇒ A)(cr: Codec[R]): DiscriminatorCodec[A, B]

    Permalink

    Returns a new discriminator codec with a new case added for the specified tag.

    Returns a new discriminator codec with a new case added for the specified tag. Operator alias for caseP.

    R

    representative type that this case handles

    tag

    tag value for this case

    toRep

    partial function from A to R used during encoding

    fromRep

    function used during decoding that converts an R to an A

    cr

    codec that encodes/decodes Rs

  111. final def ~[B](codecB: Codec[B]): Codec[(A, B)]

    Permalink

    Creates a Codec[(A, B)] that first encodes/decodes an A followed by a B.

    Creates a Codec[(A, B)] that first encodes/decodes an A followed by a B.

    Operator alias for pairedWith.

    Definition Classes
    Codec
  112. final def ~>[B](codecB: Codec[B])(implicit ev: =:=[Unit, A]): Codec[B]

    Permalink

    Assuming A is Unit, creates a Codec[B] that: encodes the unit followed by a B; decodes a unit followed by a B and discards the decoded unit.

    Assuming A is Unit, creates a Codec[B] that: encodes the unit followed by a B; decodes a unit followed by a B and discards the decoded unit.

    Operator alias of dropLeft.

    Definition Classes
    Codec
  113. def ~~[B](B: Codec[B]): TupleCodec[A, B]

    Permalink
    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to Tuple2CodecSupport[A] performed by method Tuple2CodecSupport in scodec.
    Definition Classes
    Tuple2CodecSupport
  114. def [B](y: B): (DiscriminatorCodec[A, B], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to ArrowAssoc[DiscriminatorCodec[A, B]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Shadowed Implicit Value Members

  1. def exmap[B](f: (A) ⇒ Attempt[B], g: (B) ⇒ Attempt[A]): Codec[B]

    Permalink

    Transforms using two functions, A => Attempt[B] and B => Attempt[A].

    Transforms using two functions, A => Attempt[B] and B => Attempt[A].

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to TransformSyntax[Codec, A] performed by method TransformSyntax in scodec.
    Shadowing
    This implicitly inherited member is shadowed by one or more members in this class.
    To access this member you can use a type ascription:
    (discriminatorCodec: TransformSyntax[Codec, A]).exmap(f, g)
    Definition Classes
    TransformSyntax
  2. def narrow[B](f: (A) ⇒ Attempt[B], g: (B) ⇒ A): Codec[B]

    Permalink

    Transforms using two functions, A => Attempt[B] and B => A.

    Transforms using two functions, A => Attempt[B] and B => A.

    The supplied functions form an injection from B to A. Hence, this method converts from a larger to a smaller type. Hence, the name narrow.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to TransformSyntax[Codec, A] performed by method TransformSyntax in scodec.
    Shadowing
    This implicitly inherited member is shadowed by one or more members in this class.
    To access this member you can use a type ascription:
    (discriminatorCodec: TransformSyntax[Codec, A]).narrow(f, g)
    Definition Classes
    TransformSyntax
  3. val self: Codec[A]

    Permalink
    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to Tuple2CodecSupport[A] performed by method Tuple2CodecSupport in scodec.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (discriminatorCodec: Tuple2CodecSupport[A]).self
    Definition Classes
    Tuple2CodecSupport
  4. val self: Decoder[A]

    Permalink
    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to EnrichedCoproductDecoder[A] performed by method EnrichedCoproductDecoder in scodec. This conversion will take place only if A is a subclass of Coproduct (A <: Coproduct).
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (discriminatorCodec: EnrichedCoproductDecoder[A]).self
    Definition Classes
    EnrichedCoproductDecoder
  5. val self: Encoder[Coproduct]

    Permalink
    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to EnrichedCoproductEncoder[Coproduct] performed by method EnrichedCoproductEncoder in scodec. This conversion will take place only if A is a superclass of Coproduct (A >: Coproduct).
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (discriminatorCodec: EnrichedCoproductEncoder[Coproduct]).self
    Definition Classes
    EnrichedCoproductEncoder
  6. val self: Codec[A]

    Permalink
    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to ValueCodecEnrichedWithGenericSupport[A] performed by method ValueCodecEnrichedWithGenericSupport in scodec.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (discriminatorCodec: ValueCodecEnrichedWithGenericSupport[A]).self
    Definition Classes
    ValueCodecEnrichedWithGenericSupport
  7. val self: Codec[A]

    Permalink
    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to ValueCodecEnrichedWithHListSupport[A] performed by method ValueCodecEnrichedWithHListSupport in scodec.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (discriminatorCodec: ValueCodecEnrichedWithHListSupport[A]).self
    Definition Classes
    ValueCodecEnrichedWithHListSupport
  8. val self: Codec[A]

    Permalink
    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to HListCodecEnrichedWithHListSupport[A] performed by method HListCodecEnrichedWithHListSupport in scodec. This conversion will take place only if A is a subclass of HList (A <: HList).
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (discriminatorCodec: HListCodecEnrichedWithHListSupport[A]).self
    Definition Classes
    HListCodecEnrichedWithHListSupport
  9. val self: Codec[A]

    Permalink

    Supports TransformSyntax.

    Supports TransformSyntax.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to TransformSyntax[Codec, A] performed by method TransformSyntax in scodec.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (discriminatorCodec: TransformSyntax[Codec, A]).self
    Definition Classes
    TransformSyntax
  10. def widen[B](f: (A) ⇒ B, g: (B) ⇒ Attempt[A]): Codec[B]

    Permalink

    Transforms using two functions, A => B and B => Attempt[A].

    Transforms using two functions, A => B and B => Attempt[A].

    The supplied functions form an injection from A to B. Hence, this method converts from a smaller to a larger type. Hence, the name widen.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to TransformSyntax[Codec, A] performed by method TransformSyntax in scodec.
    Shadowing
    This implicitly inherited member is shadowed by one or more members in this class.
    To access this member you can use a type ascription:
    (discriminatorCodec: TransformSyntax[Codec, A]).widen(f, g)
    Definition Classes
    TransformSyntax
  11. def xmap[B](f: (A) ⇒ B, g: (B) ⇒ A): Codec[B]

    Permalink

    Transforms using the isomorphism described by two functions, A => B and B => A.

    Transforms using the isomorphism described by two functions, A => B and B => A.

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to TransformSyntax[Codec, A] performed by method TransformSyntax in scodec.
    Shadowing
    This implicitly inherited member is shadowed by one or more members in this class.
    To access this member you can use a type ascription:
    (discriminatorCodec: TransformSyntax[Codec, A]).xmap(f, g)
    Definition Classes
    TransformSyntax
  12. def ~[B](b: B): (DiscriminatorCodec[A, B], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to ValueEnrichedWithTuplingSupport[DiscriminatorCodec[A, B]] performed by method ValueEnrichedWithTuplingSupport in scodec.codecs.
    Shadowing
    This implicitly inherited member is shadowed by one or more members in this class.
    To access this member you can use a type ascription:
    (discriminatorCodec: ValueEnrichedWithTuplingSupport[DiscriminatorCodec[A, B]]).~(b)
    Definition Classes
    ValueEnrichedWithTuplingSupport

Deprecated Value Members

  1. def pxmap[B](f: (A) ⇒ B, g: (B) ⇒ Option[A]): Codec[B]

    Permalink

    Transforms using two functions, A => B and B => Option[A].

    Transforms using two functions, A => B and B => Option[A].

    Particularly useful when combined with case class apply/unapply. E.g., pxmap(fa, Foo.apply, Foo.unapply).

    Implicit information
    This member is added by an implicit conversion from DiscriminatorCodec[A, B] to TransformSyntax[Codec, A] performed by method TransformSyntax in scodec.
    Definition Classes
    TransformSyntax
    Annotations
    @deprecated
    Deprecated

    (Since version 1.7.0) Use widenOpt instead

Inherited from KnownDiscriminatorType[B]

Inherited from Codec[A]

Inherited from GenCodec[A, A]

Inherited from Decoder[A]

Inherited from Encoder[A]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion Tuple2CodecSupport from DiscriminatorCodec[A, B] to Tuple2CodecSupport[A]

Inherited by implicit conversion EnrichedCoproductDecoder from DiscriminatorCodec[A, B] to EnrichedCoproductDecoder[A]

Inherited by implicit conversion EnrichedCoproductEncoder from DiscriminatorCodec[A, B] to EnrichedCoproductEncoder[Coproduct]

Inherited by implicit conversion ValueCodecEnrichedWithGenericSupport from DiscriminatorCodec[A, B] to ValueCodecEnrichedWithGenericSupport[A]

Inherited by implicit conversion ValueCodecEnrichedWithHListSupport from DiscriminatorCodec[A, B] to ValueCodecEnrichedWithHListSupport[A]

Inherited by implicit conversion HListCodecEnrichedWithHListSupport from DiscriminatorCodec[A, B] to HListCodecEnrichedWithHListSupport[A]

Inherited by implicit conversion TransformSyntax from DiscriminatorCodec[A, B] to TransformSyntax[Codec, A]

Inherited by implicit conversion ValueEnrichedWithTuplingSupport from DiscriminatorCodec[A, B] to ValueEnrichedWithTuplingSupport[DiscriminatorCodec[A, B]]

Inherited by implicit conversion any2stringadd from DiscriminatorCodec[A, B] to any2stringadd[DiscriminatorCodec[A, B]]

Inherited by implicit conversion StringFormat from DiscriminatorCodec[A, B] to StringFormat[DiscriminatorCodec[A, B]]

Inherited by implicit conversion Ensuring from DiscriminatorCodec[A, B] to Ensuring[DiscriminatorCodec[A, B]]

Inherited by implicit conversion ArrowAssoc from DiscriminatorCodec[A, B] to ArrowAssoc[DiscriminatorCodec[A, B]]

Primary Members

Discriminator Support

Basic Combinators

Tuple Support

HList Support

Coproduct Support

Generic Support

Ungrouped