trait Decoder[+A] extends AnyRef
Supports decoding a value of type A
from a BitVector
.
- Self Type
- Decoder[A]
- Source
- Decoder.scala
- Grouped
- Alphabetic
- By Inheritance
- Decoder
- AnyRef
- Any
- by EnrichedCoproductDecoder
- by TransformSyntax
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
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
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- def ->[B](y: B): (Decoder[A], B)
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
as[B](implicit as: Transformer[A, B]): Decoder[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 someL <: HList
to/from anF[CC]
for some case classCC
, where the types in the case class are aligned with the types inL
- an
F[C]
for someC <: Coproduct
to/from anF[SC]
for some sealed classSC
, 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 Decoder[A] to TransformSyntax[Decoder, A] performed by method TransformSyntax in scodec.
- Definition Classes
- TransformSyntax
- an
-
def
asDecoder: Decoder[A]
Gets this as a
Decoder
. -
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
complete: Decoder[A]
Converts this decoder to a new decoder that fails decoding if there are remaining bits.
-
def
decodeOnly[AA >: A]: Codec[AA]
Converts this to a codec that fails encoding with an error.
-
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
-
def
emap[B](f: (A) ⇒ Attempt[B]): Decoder[B]
Converts this decoder to a
Decoder[B]
using the suppliedA => Attempt[B]
. - def ensuring(cond: (Decoder[A]) ⇒ Boolean, msg: ⇒ Any): Decoder[A]
- def ensuring(cond: (Decoder[A]) ⇒ Boolean): Decoder[A]
- def ensuring(cond: Boolean, msg: ⇒ Any): Decoder[A]
- def ensuring(cond: Boolean): Decoder[A]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
exmap[B](f: (A) ⇒ Attempt[B], g: (B) ⇒ Attempt[A]): Decoder[B]
Transforms using two functions,
A => Attempt[B]
andB => Attempt[A]
.Transforms using two functions,
A => Attempt[B]
andB => Attempt[A]
.- Implicit
- This member is added by an implicit conversion from Decoder[A] to TransformSyntax[Decoder, A] performed by method TransformSyntax in scodec.
- Definition Classes
- TransformSyntax
-
def
exmapc[B](f: (A) ⇒ Attempt[B])(g: (B) ⇒ Attempt[A]): Decoder[B]
Curried version of
exmap
.Curried version of
exmap
.- Implicit
- This member is added by an implicit conversion from Decoder[A] to TransformSyntax[Decoder, A] performed by method TransformSyntax in scodec.
- Definition Classes
- TransformSyntax
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
flatMap[B](f: (A) ⇒ Decoder[B]): Decoder[B]
Converts this decoder to a
Decoder[B]
using the suppliedA => Decoder[B]
. - def formatted(fmtstr: String): String
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
map[B](f: (A) ⇒ B): Decoder[B]
Converts this decoder to a
Decoder[B]
using the suppliedA => B
. -
def
narrow[B](f: (A) ⇒ Attempt[B], g: (B) ⇒ A): Decoder[B]
Transforms using two functions,
A => Attempt[B]
andB => A
.Transforms using two functions,
A => Attempt[B]
andB => A
.The supplied functions form an injection from
B
toA
. Hence, this method converts from a larger to a smaller type. Hence, the namenarrow
.- Implicit
- This member is added by an implicit conversion from Decoder[A] to TransformSyntax[Decoder, A] performed by method TransformSyntax in scodec.
- Definition Classes
- TransformSyntax
-
def
narrowc[B](f: (A) ⇒ Attempt[B])(g: (B) ⇒ A): Decoder[B]
Curried version of
narrow
.Curried version of
narrow
.- Implicit
- This member is added by an implicit conversion from Decoder[A] to TransformSyntax[Decoder, A] performed by method TransformSyntax in scodec.
- Definition Classes
- TransformSyntax
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
selectDecoder[A](implicit sel: Selector[A, A]): Decoder[Option[A]]
When called on a
Decoder[C]
whereC
is a coproduct containing typeA
, converts to aDecoder[Option[A]]
.When called on a
Decoder[C]
whereC
is a coproduct containing typeA
, converts to aDecoder[Option[A]]
.- Implicit
- This member is added by an implicit conversion from Decoder[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
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
widen[B](f: (A) ⇒ B, g: (B) ⇒ Attempt[A]): Decoder[B]
Transforms using two functions,
A => B
andB => Attempt[A]
.Transforms using two functions,
A => B
andB => Attempt[A]
.The supplied functions form an injection from
A
toB
. Hence, this method converts from a smaller to a larger type. Hence, the namewiden
.- Implicit
- This member is added by an implicit conversion from Decoder[A] to TransformSyntax[Decoder, A] performed by method TransformSyntax in scodec.
- Definition Classes
- TransformSyntax
-
def
widenOpt[B](f: (A) ⇒ B, g: (B) ⇒ Option[A]): Decoder[B]
Transforms using two functions,
A => B
andB => Option[A]
.Transforms using two functions,
A => B
andB => 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 Decoder[A] to TransformSyntax[Decoder, A] performed by method TransformSyntax in scodec.
- Definition Classes
- TransformSyntax
-
def
widenOptc[B](f: (A) ⇒ B)(g: (B) ⇒ Option[A]): Decoder[B]
Curried version of
widenOpt
.Curried version of
widenOpt
.- Implicit
- This member is added by an implicit conversion from Decoder[A] to TransformSyntax[Decoder, A] performed by method TransformSyntax in scodec.
- Definition Classes
- TransformSyntax
-
def
widenc[B](f: (A) ⇒ B)(g: (B) ⇒ Attempt[A]): Decoder[B]
Curried version of
widen
.Curried version of
widen
.- Implicit
- This member is added by an implicit conversion from Decoder[A] to TransformSyntax[Decoder, A] performed by method TransformSyntax in scodec.
- Definition Classes
- TransformSyntax
-
def
xmap[B](f: (A) ⇒ B, g: (B) ⇒ A): Decoder[B]
Transforms using the isomorphism described by two functions,
A => B
andB => A
.Transforms using the isomorphism described by two functions,
A => B
andB => A
.- Implicit
- This member is added by an implicit conversion from Decoder[A] to TransformSyntax[Decoder, A] performed by method TransformSyntax in scodec.
- Definition Classes
- TransformSyntax
-
def
xmapc[B](f: (A) ⇒ B)(g: (B) ⇒ A): Decoder[B]
Curried version of
xmap
.Curried version of
xmap
.- Implicit
- This member is added by an implicit conversion from Decoder[A] to TransformSyntax[Decoder, A] performed by method TransformSyntax in scodec.
- Definition Classes
- TransformSyntax
- def →[B](y: B): (Decoder[A], B)
Shadowed Implicit Value Members
-
val
self: Decoder[A]
- Implicit
- This member is added by an implicit conversion from Decoder[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:(decoder: EnrichedCoproductDecoder[A]).self
- Definition Classes
- EnrichedCoproductDecoder
-
val
self: Decoder[A]
- Implicit
- This member is added by an implicit conversion from Decoder[A] to TransformSyntax[Decoder, 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:(decoder: TransformSyntax[Decoder, A]).self
- Definition Classes
- TransformSyntax
Deprecated Value Members
-
def
pxmap[B](f: (A) ⇒ B, g: (B) ⇒ Option[A]): Decoder[B]
Transforms using two functions,
A => B
andB => Option[A]
.Transforms using two functions,
A => B
andB => 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 Decoder[A] to TransformSyntax[Decoder, A] performed by method TransformSyntax in scodec.
- Definition Classes
- TransformSyntax
- Annotations
- @deprecated
- Deprecated
(Since version 1.7.0) Use widenOpt instead