Packages

  • package root
    Definition Classes
    root
  • package scodec

    Combinator library for working with binary data.

    Combinator library for working with binary data.

    The primary abstraction of this library is Codec, which provides the ability to encode/decode values to/from binary.

    There are more general abstractions though, such as Encoder and Decoder. There's also GenCodec which extends both Encoder and Decoder but allows the types to vary. Given these more general abstractions, a Codec[A] can be represented as a GenCodec[A, A].

    The more general abstractions are important because they allow operations on codecs that would not otherwise be possible. For example, given a Codec[A], mapping a function A => B over the codec yields a GenCodec[A, B]. Without the more general abstractions, map is impossible to define (e.g., how would codec.map(f).encode(b) be implemented?). Given a GenCodec[A, B], the encoding functionality can be ignored by treating it as a Decoder[B], or the encoding type can be changed via contramap. If after further transformations, the two types to GenCodec are equal, we can reconstitute a Codec from the GenCodec by calling fuse.

    See the codecs package object for pre-defined codecs for many common data types and combinators for building larger codecs out of smaller ones.

    For the categorically minded, note the following:

    • Decoder is a monad
    • Encoder is a contravariant functor
    • GenCodec is a profunctor
    • Codec is an invariant functor
    Definition Classes
    root
  • package codecs

    Provides codecs for common types and combinators for building larger codecs.

    Provides codecs for common types and combinators for building larger codecs.

    Bits and Bytes Codecs

    The simplest of the provided codecs are those that encode/decode BitVectors and ByteVectors directly. These are provided by bits and bytes methods. These codecs encode all of the bits/bytes directly in to the result and decode *all* of the remaining bits/bytes in to the result value. That is, the result of decode always returns a empty bit vector for the remaining bits.

    Similarly, fixed size alternatives are provided by the bits(size) and bytes(size) methods, which encode a fixed number of bits/bytes (or error if not provided the correct size) and decoded a fixed number of bits/bytes (or error if that many bits/bytes are not available).

    There are more specialized codecs for working with bits, including ignore and constant.

    Numeric Codecs

    There are built-in codecs for Int, Long, Float, and Double.

    There are a number of predefined integral codecs named using the form:

    [u]int$${size}[L]

    where u stands for unsigned, size is replaced by one of 8, 16, 24, 32, 64, and L stands for little-endian. For each codec of that form, the type is Codec[Int] or Codec[Long] depending on the specified size. For example, int32 supports 32-bit big-endian 2s complement signed integers, and uint16L supports 16-bit little-endian unsigned integers. Note: uint64[L] are not provided because a 64-bit unsigned integer does not fit in to a Long.

    Additionally, methods of the form [u]int[L](size: Int) and [u]long[L](size: Int) exist to build arbitrarily sized codecs, within the limitations of Int and Long.

    IEEE 754 floating point values are supported by the float, floatL, double, and doubleL codecs.

    Miscellaneous Value Codecs

    In addition to the numeric codecs, there are built-in codecs for Boolean, String, and UUID.

    Boolean values are supported by the bool codecs.

    Combinators

    There are a number of methods provided that create codecs out of other codecs. These include simple combinators such as fixedSizeBits and variableSizeBits and advanced combinators such as discriminated, which provides its own DSL for building a large codec out of many small codecs. For a list of all combinators, see the Combinators section below.

    Cryptography Codecs

    There are codecs that support working with encrypted data (encrypted), digital signatures and checksums (fixedSizeSignature and variableSizeSignature). Additionally, support for java.security.cert.Certificates is provided by certificate and x509Certificate.

    Definition Classes
    scodec
  • Attempt
  • BuildInfo
  • Codec
  • CodecTransformation
  • DecodeResult
  • Decoder
  • DecoderFunctions
  • DecodingContext
  • Encoder
  • EncoderFunctions
  • EnrichedCoproductDecoder
  • EnrichedCoproductEncoder
  • EnrichedHList
  • Err
  • GenCodec
  • HListCodecEnrichedWithHListSupport
  • SizeBound
  • Transform
  • TransformSyntax
  • Transformer
  • Tuple2CodecSupport
  • ValueCodecEnrichedWithGenericSupport
  • ValueCodecEnrichedWithHListSupport

trait Codec[A] extends GenCodec[A, A]

Supports encoding a value of type A to a BitVector and decoding a BitVector to a value of A.

Not every value of A can be encoded to a bit vector and similarly, not every bit vector can be decoded to a value of type A. Hence, both encode and decode return either an error or the result. Furthermore, decode returns the remaining bits in the bit vector that it did not use in decoding.

There are various ways to create instances of Codec. The trait can be implemented directly or one of the constructor methods in the companion can be used (e.g., apply). Most of the methods on Codec create return a new codec that has been transformed in some way. For example, the xmap method converts a Codec[A] to a Codec[B] given two functions, A => B and B => A.

One of the simplest transformation methods is def withContext(context: String): Codec[A], which pushes the specified context string in to any errors (i.e., Errs) returned from encode or decode.

See the methods on this trait for additional transformation types.

See the codecs package object for pre-defined codecs for many common data types and combinators for building larger codecs out of smaller ones.

Tuple Codecs

The ~ operator supports combining a Codec[A] and a Codec[B] in to a Codec[(A, B)].

For example:

val codec: Codec[Int ~ Int ~ Int] = uint8 ~ uint8 ~ uint8

Codecs generated with ~ result in left nested tuples. These left nested tuples can be pulled back apart by pattern matching with ~. For example:

Codec.decode(uint8 ~ uint8 ~ uint8, bytes) map { case a ~ b ~ c => a + b + c }

Alternatively, a function of N arguments can be lifted to a function of left-nested tuples. For example:

val add3 = (_: Int) + (_: Int) + (_: Int)
Codec.decode(uint8 ~ uint8 ~ uint8, bytes) map add3

Similarly, a left nested tuple can be created with the ~ operator. This is useful when creating the tuple structure to pass to encode. For example:

(uint8 ~ uint8 ~ uint8).encode(1 ~ 2 ~ 3)

Tuple based codecs are of limited use compared to HList based codecs, which is discussed later.

Note: this design is heavily based on Scala's parser combinator library and the syntax it provides.

flatZip

Sometimes when combining codecs, a latter codec depends on a formerly decoded value. The flatZip method is important in these types of situations -- it represents a dependency between the left hand side and right hand side. Its signature is def flatZip[B](f: A => Codec[B]): Codec[(A, B)]. This is similar to flatMap except the return type is Codec[(A, B)] instead of Decoder[B].

Consider a binary format of an 8-bit unsigned integer indicating the number of bytes following it. To implement this with flatZip, we could write:

val x: Codec[(Int, ByteVector)] = uint8 flatZip { numBytes => bytes(numBytes) }
val y: Codec[ByteVector] = x.xmap[ByteVector]({ case (_, bv) => bv }, bv => (bv.size, bv))

In this example, x is a Codec[(Int, ByteVector)] but we do not need the size directly in the model because it is redundant with the size stored in the ByteVector. Hence, we remove the Int by xmap-ping over x. The notion of removing redundant data from models comes up frequently. Note: there is a combinator that expresses this pattern more succinctly -- variableSizeBytes(uint8, bytes).

HList Codecs

HLists are similar to tuples in that they represent the product of an arbitrary number of types. That is, the size of an HList is known at compile time and the type of each element is also known at compile time. For more information on HLists in general, see Shapeless.

Codec makes heavy use of HLists. The primary operation is extending a Codec[L] for some L <: HList to a Codec[A :: L]. For example:

val uint8: Codec[Int] = ...
val string: Codec[String] = ...
val codec: Codec[Int :: Int :: String] = uint8 :: uint8 :: string

The :: method is sort of like cons-ing on to the HList but it is doing so *inside* the Codec type. The resulting codec encodes values by passing each component of the HList to the corresponding codec and concatenating all of the results.

There are various methods on this trait that only work on Codec[L] for some L <: HList. Besides the aforementioned :: method, there are others like :::, flatPrepend, flatConcat, etc. One particularly useful method is dropUnits, which removes any Unit values from the HList.

Given a Codec[X0 :: X1 :: ... Xn :: HNil] and a case class with types X0 to Xn in the same order, the HList codec can be turned in to a case class codec via the as method. For example:

case class Point(x: Int, y: Int, z: Int)
val threeInts: Codec[Int :: Int :: Int :: HNil] = uint8 :: uint8 :: uint8
val point: Codec[Point] = threeInts.as[Point]
flatPrepend

The HList analog to flatZip is flatPrepend. It has the signature:

def flatPrepend[L <: HList](f: A => Codec[L]): Codec[A :: L]

It forms a codec of A consed on to L when called on a Codec[A] and passed a function A => Codec[L]. Note that the specified function must return an HList based codec. Implementing our example from earlier using flatPrepend:

val x: Codec[Int :: ByteVector :: HNil] = uint8 flatPrepend { numBytes => bytes(numBytes).hlist }

In this example, bytes(numBytes) returns a Codec[ByteVector] so we called .hlist on it to lift it in to a Codec[ByteVector :: HNil].

There are similar methods for flat appending and flat concating.

Coproduct Codecs

Given some ordered list of types, potentially with duplicates, a value of the HList of those types has a value for *every* type in the list. In other words, an HList represents having an X0 AND X1 AND ... AND XN. A Coproduct for the same list of types represents having a value for *one* of those types. In other words, a Coproduct represents having an X0 OR X1 OR ... OR XN. This is somewhat imprecise because a coproduct can tell us exactly which Xi we have, even in the presence of duplicate types.

A coproduct can also be thought of as an Either that has an unlimited number of choices instead of just 2 choices.

Shapeless represents coproducts in a similar way as HLists. A coproduct type is built using the :+: operator with a sentinal value of CNil. For example, an Int or Long or String is represented as the coproduct type:

Int :+: Long :+: String :+: CNil

For more information on coproducts in general, see Shapeless.

Like HList based codecs, scodec supports Coproduct based codecs by coopting syntax from Shapeless. Specifically, the :+: operator is used:

val builder = uint8 :+: int64 :+: utf8

Unlike HList based codecs, the result of :+: is not a codec but rather a codecs.CoproductCodecBuilder. Having a list of types and a codec for each is not sufficient to build a coproduct codec. We also need to describe how each entry in the coproduct is differentiated from the other entries. There are a number of ways to do this and each way changes the binary format significantly. See the docs on CoproductCodecBuilder for details.

Derived Codecs

Codecs for case classes and sealed class hierarchies can often be automatically derived.

Consider this example:

import scodec.codecs.implicits._
case class Point(x: Int, y: Int, z: Int)
Codec[Point].encode(Point(1, 2, 3))

In this example, no explicit codec was defined for Point yet Codec[Point] successfully created one. It did this by "reflecting" over the structure of Point and looking up a codec for each component type (note: no runtime reflection is performed - rather, this is implemented using macro-based compile time reflection). In this case, there are three components, each of type Int, so the compiler first looked for an implicit Codec[Int]. It then combined each Codec[Int] using an HList based codec and finally converted the HList codec to a Codec[Point]. It found the implicit Codec[Int] instances due to the import of scodec.codecs.implicits._. Furthermore, if there was an error encoding or decoding a field, the field name (i.e., x, y, or z) is included as context on the Err returned.

This works similarly for sealed class hierarchies -- each subtype is internally represented as a member of a coproduct. There must be the following implicits in scope however:

  • Discriminated[A, D] for some discriminator type D, which provides the Codec[D] to use for encoding/decoding the discriminator
  • Discriminator[A, X, D] for each subtype X of A, which provides the discriminator value for type X
  • Codec[X] for each subtype X of A

Full examples are available in the test directory of this project.

Implicit Codecs

If authoring combinators that require implicit codec arguments, use shapeless.Lazy[Codec[A]] instead of Codec[A]. This prevents the occurrence of diverging implicit expansion errors.

Self Type
Codec[A]
Source
Codec.scala
Linear Supertypes
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. Codec
  2. GenCodec
  3. Decoder
  4. Encoder
  5. AnyRef
  6. 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 any2stringadd
  9. by StringFormat
  10. by Ensuring
  11. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def decode(bits: BitVector): Attempt[DecodeResult[A]]

    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
    Decoder
  2. abstract def encode(value: A): Attempt[BitVector]

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

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

    value

    value to encode

    returns

    error or binary encoding of the value

    Definition Classes
    Encoder
  3. abstract def sizeBound: SizeBound

    Provides a bound on the size of successfully encoded values.

    Provides a bound on the size of successfully encoded values.

    Definition Classes
    Encoder

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from Codec[A] to any2stringadd[Codec[A]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (Codec[A], B)
    Implicit
    This member is added by an implicit conversion from Codec[A] to ArrowAssoc[Codec[A]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. 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]

    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
    This member is added by an implicit conversion from Codec[A] 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
  6. def :+:[B](left: Codec[B]): CoproductCodecBuilder[:+:[B, :+:[A, CNil]], ::[Codec[B], ::[Codec[A], HNil]], :+:[B, :+:[A, CNil]]]

    Supports creation of a coproduct codec.

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

  7. def ::[B](codecB: Codec[B]): Codec[::[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.

    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
    This member is added by an implicit conversion from Codec[A] to ValueCodecEnrichedWithHListSupport[A] performed by method ValueCodecEnrichedWithHListSupport in scodec.
    Definition Classes
    ValueCodecEnrichedWithHListSupport
  8. def ::[B](codec: Codec[B]): Codec[::[B, A]]

    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
    This member is added by an implicit conversion from Codec[A] 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
  9. 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]

    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
    This member is added by an implicit conversion from Codec[A] 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
  10. def :~>:[B](codecB: Codec[B])(implicit ev: =:=[Unit, B]): Codec[::[A, HNil]]

    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
    This member is added by an implicit conversion from Codec[A] to ValueCodecEnrichedWithHListSupport[A] performed by method ValueCodecEnrichedWithHListSupport in scodec.
    Definition Classes
    ValueCodecEnrichedWithHListSupport
  11. def :~>:[B](codec: Codec[B])(implicit ev: =:=[Unit, B]): Codec[A]

    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
    This member is added by an implicit conversion from Codec[A] 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. final def <~[B](codecB: Codec[B])(implicit ev: =:=[Unit, B]): Codec[A]

    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.

  13. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  14. def >>:~[L <: HList](f: (A) ⇒ Codec[L]): Codec[::[A, L]]

    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
    This member is added by an implicit conversion from Codec[A] to ValueCodecEnrichedWithHListSupport[A] performed by method ValueCodecEnrichedWithHListSupport in scodec.
    Definition Classes
    ValueCodecEnrichedWithHListSupport
  15. final def >>~[B](f: (A) ⇒ Codec[B]): Codec[(A, B)]

    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.

  16. def as[B](implicit as: Transformer[A, B]): Codec[B]

    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
    This member is added by an implicit conversion from Codec[A] to TransformSyntax[Codec, A] performed by method TransformSyntax in scodec.
    Definition Classes
    TransformSyntax
  17. def asDecoder: Decoder[A]

    Gets this as a Decoder.

    Gets this as a Decoder.

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

    Gets this as an Encoder.

    Gets this as an Encoder.

    Definition Classes
    Encoder
  19. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  20. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def compact: Codec[A]

    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
  22. final def complete: Codec[A]

    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
  23. final def consume[B](f: (A) ⇒ Codec[B])(g: (B) ⇒ A): Codec[B]

    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).

  24. def contramap[C](f: (C) ⇒ A): GenCodec[C, A]

    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
  25. def decodeOnly[AA >: A]: Codec[AA]

    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
  26. final def decodeValue(bits: BitVector): Attempt[A]

    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
  27. def derive[A]: DeriveHListElementAux[A, A]

    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
    This member is added by an implicit conversion from Codec[A] 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
  28. final def downcast[B <: A](implicit tb: Typeable[B]): Codec[B]

    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.

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

    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.

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

    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.

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

    Creates a new codec with all unit values filtered out.

    Creates a new codec with all unit values filtered out.

    Implicit
    This member is added by an implicit conversion from Codec[A] 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
  32. def econtramap[C](f: (C) ⇒ Attempt[A]): GenCodec[C, A]

    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
  33. def emap[C](f: (A) ⇒ Attempt[C]): GenCodec[A, C]

    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
  34. def encodeOnly: Codec[A]

    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
  35. def ensuring(cond: (Codec[A]) ⇒ Boolean, msg: ⇒ Any): Codec[A]
    Implicit
    This member is added by an implicit conversion from Codec[A] to Ensuring[Codec[A]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  36. def ensuring(cond: (Codec[A]) ⇒ Boolean): Codec[A]
    Implicit
    This member is added by an implicit conversion from Codec[A] to Ensuring[Codec[A]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  37. def ensuring(cond: Boolean, msg: ⇒ Any): Codec[A]
    Implicit
    This member is added by an implicit conversion from Codec[A] to Ensuring[Codec[A]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  38. def ensuring(cond: Boolean): Codec[A]
    Implicit
    This member is added by an implicit conversion from Codec[A] to Ensuring[Codec[A]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  39. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  40. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  41. final def exmap[B](f: (A) ⇒ Attempt[B], g: (B) ⇒ Attempt[A]): Codec[B]

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

  42. def exmapc[B](f: (A) ⇒ Attempt[B])(g: (B) ⇒ Attempt[A]): Codec[B]

    Curried version of exmap.

    Curried version of exmap.

    Implicit
    This member is added by an implicit conversion from Codec[A] to TransformSyntax[Codec, A] performed by method TransformSyntax in scodec.
    Definition Classes
    TransformSyntax
  43. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  44. 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]

    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
    This member is added by an implicit conversion from Codec[A] 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
  45. 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]

    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
    This member is added by an implicit conversion from Codec[A] 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
  46. def flatMap[B](f: (A) ⇒ Decoder[B]): Decoder[B]

    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
  47. def flatPrepend[L <: HList](f: (A) ⇒ Codec[L]): Codec[::[A, L]]

    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
    This member is added by an implicit conversion from Codec[A] to ValueCodecEnrichedWithHListSupport[A] performed by method ValueCodecEnrichedWithHListSupport in scodec.
    Definition Classes
    ValueCodecEnrichedWithHListSupport
  48. final def flatZip[B](f: (A) ⇒ Codec[B]): Codec[(A, B)]

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

  49. def flatZipHList[B](f: (A) ⇒ Codec[B]): Codec[::[A, ::[B, HNil]]]

    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
    This member is added by an implicit conversion from Codec[A] to ValueCodecEnrichedWithHListSupport[A] performed by method ValueCodecEnrichedWithHListSupport in scodec.
    Definition Classes
    ValueCodecEnrichedWithHListSupport
  50. final def flattenLeftPairs(implicit f: FlattenLeftPairs[A]): Codec[Out]

    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 <~.

  51. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from Codec[A] to StringFormat[Codec[A]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  52. final def fuse[AA <: A, BB >: A](implicit ev: =:=[BB, AA]): Codec[BB]

    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
  53. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  54. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  55. final def hlist: Codec[::[A, HNil]]

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

  56. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  57. def map[C](f: (A) ⇒ C): GenCodec[A, C]

    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
  58. final def narrow[B](f: (A) ⇒ Attempt[B], g: (B) ⇒ A): Codec[B]

    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.

  59. def narrowc[B](f: (A) ⇒ Attempt[B])(g: (B) ⇒ A): Codec[B]

    Curried version of narrow.

    Curried version of narrow.

    Implicit
    This member is added by an implicit conversion from Codec[A] to TransformSyntax[Codec, A] performed by method TransformSyntax in scodec.
    Definition Classes
    TransformSyntax
  60. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  61. final def notify(): Unit
    Definition Classes
    AnyRef
  62. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  63. final def pairedWith[B](codecB: Codec[B]): Codec[(A, B)]

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

  64. def pcontramap[C](f: (C) ⇒ Option[A]): GenCodec[C, A]

    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
  65. def polyxmap[B](p: Poly, q: Poly)(implicit aToB: Aux[p.type, ::[A, HNil], B], bToA: Aux[q.type, ::[B, HNil], A]): Codec[B]

    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
    This member is added by an implicit conversion from Codec[A] to ValueCodecEnrichedWithGenericSupport[A] performed by method ValueCodecEnrichedWithGenericSupport in scodec.
    Definition Classes
    ValueCodecEnrichedWithGenericSupport
  66. def polyxmap[M <: HList](p: Poly, q: Poly)(implicit lToM: Aux[p.type, A, M], mToL: Aux[q.type, M, A]): Codec[M]

    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
    This member is added by an implicit conversion from Codec[A] 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
  67. def polyxmap1[B](p: Poly)(implicit aToB: Aux[p.type, ::[A, HNil], B], bToA: Aux[p.type, ::[B, HNil], A]): Codec[B]

    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
    This member is added by an implicit conversion from Codec[A] to ValueCodecEnrichedWithGenericSupport[A] performed by method ValueCodecEnrichedWithGenericSupport in scodec.
    Definition Classes
    ValueCodecEnrichedWithGenericSupport
  68. def polyxmap1[M <: HList](p: Poly)(implicit m: Aux[p.type, A, M], m2: Aux[p.type, M, A]): Codec[M]

    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
    This member is added by an implicit conversion from Codec[A] 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
  69. def selectDecoder[A](implicit sel: Selector[A, A]): Decoder[Option[A]]

    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
    This member is added by an implicit conversion from Codec[A] 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
  70. def selectEncoder[A](implicit inj: Inject[Coproduct, A]): Encoder[A]

    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
    This member is added by an implicit conversion from Codec[A] 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
  71. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  72. def toField[K]: Codec[FieldType[K, A]]

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

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

    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.

  74. def toString(): String
    Definition Classes
    AnyRef → Any
  75. final def unit(zero: A): Codec[Unit]

    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.

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

    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.

  77. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  78. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  79. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  80. final def widen[B](f: (A) ⇒ B, g: (B) ⇒ Attempt[A]): Codec[B]

    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.

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

    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
    This member is added by an implicit conversion from Codec[A] to TransformSyntax[Codec, A] performed by method TransformSyntax in scodec.
    Definition Classes
    TransformSyntax
  82. def widenOptc[B](f: (A) ⇒ B)(g: (B) ⇒ Option[A]): Codec[B]

    Curried version of widenOpt.

    Curried version of widenOpt.

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

    Curried version of widen.

    Curried version of widen.

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

    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.

  85. final def withToString(str: ⇒ String): Codec[A]

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

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

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

  87. def xmapc[B](f: (A) ⇒ B)(g: (B) ⇒ A): Codec[B]

    Curried version of xmap.

    Curried version of xmap.

    Implicit
    This member is added by an implicit conversion from Codec[A] to TransformSyntax[Codec, A] performed by method TransformSyntax in scodec.
    Definition Classes
    TransformSyntax
  88. final def ~[B](codecB: Codec[B]): Codec[(A, B)]

    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.

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

    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.

  90. def ~~[B](B: Codec[B]): TupleCodec[A, B]
    Implicit
    This member is added by an implicit conversion from Codec[A] to Tuple2CodecSupport[A] performed by method Tuple2CodecSupport in scodec.
    Definition Classes
    Tuple2CodecSupport
  91. def [B](y: B): (Codec[A], B)
    Implicit
    This member is added by an implicit conversion from Codec[A] to ArrowAssoc[Codec[A]] 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]

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

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

    Implicit
    This member is added by an implicit conversion from Codec[A] 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:
    (codec: TransformSyntax[Codec, A]).exmap(f, g)
    Definition Classes
    TransformSyntax
  2. def narrow[B](f: (A) ⇒ Attempt[B], g: (B) ⇒ A): Codec[B]

    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
    This member is added by an implicit conversion from Codec[A] 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:
    (codec: TransformSyntax[Codec, A]).narrow(f, g)
    Definition Classes
    TransformSyntax
  3. val self: Codec[A]
    Implicit
    This member is added by an implicit conversion from Codec[A] 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:
    (codec: Tuple2CodecSupport[A]).self
    Definition Classes
    Tuple2CodecSupport
  4. val self: Decoder[A]
    Implicit
    This member is added by an implicit conversion from Codec[A] 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:
    (codec: EnrichedCoproductDecoder[A]).self
    Definition Classes
    EnrichedCoproductDecoder
  5. val self: Encoder[Coproduct]
    Implicit
    This member is added by an implicit conversion from Codec[A] 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:
    (codec: EnrichedCoproductEncoder[Coproduct]).self
    Definition Classes
    EnrichedCoproductEncoder
  6. val self: Codec[A]
    Implicit
    This member is added by an implicit conversion from Codec[A] 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:
    (codec: ValueCodecEnrichedWithGenericSupport[A]).self
    Definition Classes
    ValueCodecEnrichedWithGenericSupport
  7. val self: Codec[A]
    Implicit
    This member is added by an implicit conversion from Codec[A] 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:
    (codec: ValueCodecEnrichedWithHListSupport[A]).self
    Definition Classes
    ValueCodecEnrichedWithHListSupport
  8. val self: Codec[A]
    Implicit
    This member is added by an implicit conversion from Codec[A] 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:
    (codec: HListCodecEnrichedWithHListSupport[A]).self
    Definition Classes
    HListCodecEnrichedWithHListSupport
  9. val self: Codec[A]
    Implicit
    This member is added by an implicit conversion from Codec[A] 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:
    (codec: TransformSyntax[Codec, A]).self
    Definition Classes
    TransformSyntax
  10. def widen[B](f: (A) ⇒ B, g: (B) ⇒ Attempt[A]): Codec[B]

    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
    This member is added by an implicit conversion from Codec[A] 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:
    (codec: TransformSyntax[Codec, A]).widen(f, g)
    Definition Classes
    TransformSyntax
  11. def xmap[B](f: (A) ⇒ B, g: (B) ⇒ A): Codec[B]

    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
    This member is added by an implicit conversion from Codec[A] 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:
    (codec: TransformSyntax[Codec, A]).xmap(f, g)
    Definition Classes
    TransformSyntax

Deprecated Value Members

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

    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
    This member is added by an implicit conversion from Codec[A] 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 GenCodec[A, A]

Inherited from Decoder[A]

Inherited from Encoder[A]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion Tuple2CodecSupport from Codec[A] to Tuple2CodecSupport[A]

Inherited by implicit conversion EnrichedCoproductDecoder from Codec[A] to EnrichedCoproductDecoder[A]

Inherited by implicit conversion EnrichedCoproductEncoder from Codec[A] to EnrichedCoproductEncoder[Coproduct]

Inherited by implicit conversion ValueCodecEnrichedWithGenericSupport from Codec[A] to ValueCodecEnrichedWithGenericSupport[A]

Inherited by implicit conversion ValueCodecEnrichedWithHListSupport from Codec[A] to ValueCodecEnrichedWithHListSupport[A]

Inherited by implicit conversion HListCodecEnrichedWithHListSupport from Codec[A] to HListCodecEnrichedWithHListSupport[A]

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

Inherited by implicit conversion any2stringadd from Codec[A] to any2stringadd[Codec[A]]

Inherited by implicit conversion StringFormat from Codec[A] to StringFormat[Codec[A]]

Inherited by implicit conversion Ensuring from Codec[A] to Ensuring[Codec[A]]

Inherited by implicit conversion ArrowAssoc from Codec[A] to ArrowAssoc[Codec[A]]

Primary Members

Basic Combinators

Tuple Support

HList Support

Coproduct Support

Generic Support

Ungrouped