Decoder

object Decoder extends DecoderFunctions

Companion for Decoder.

Companion
class
class Object
trait Matchable
class Any

Value members

Concrete methods

inline
def apply[A](using d: Decoder[A]): Decoder[A]
def apply[A](f: BitVector => Attempt[DecodeResult[A]]): Decoder[A]

Creates a decoder from the specified function.

Creates a decoder from the specified function.

def get: Decoder[BitVector]

Gets a decoder that returns the input bit vector as its value and also returns the value as its remainder.

Gets a decoder that returns the input bit vector as its value and also returns the value as its remainder.

def liftAttempt[A](attempt: Attempt[A]): Decoder[A]

Lifts a value of Attempt[A] in to a Decoder.

Lifts a value of Attempt[A] in to a Decoder.

def modify(f: BitVector => BitVector): Decoder[Unit]

Gets a decoder that transforms the input bit vector with the specified function and returns the result as the remainder.

Gets a decoder that transforms the input bit vector with the specified function and returns the result as the remainder.

def pure[A](a: A): Decoder[A]

Creates a decoder that always decodes the specified value and returns the input bit vector unmodified.

Creates a decoder that always decodes the specified value and returns the input bit vector unmodified.

def set(remainder: BitVector): Decoder[Unit]

Gets a decoder that ignores its input bit vector and sets the remainder to the specified value.

Gets a decoder that ignores its input bit vector and sets the remainder to the specified value.

Inherited methods

final
def choiceDecoder[A](decoders: Decoder[A]*): Decoder[A]

Creates a decoder that decodes with each of the specified decoders, returning the first successful result.

Creates a decoder that decodes with each of the specified decoders, returning the first successful result.

Inherited from
DecoderFunctions
final
def decodeBoth[A, B](decA: Decoder[A], decB: Decoder[B])(buffer: BitVector): Attempt[DecodeResult[(A, B)]]

Decodes a tuple (A, B) by first decoding A and then using the remaining bits to decode B.

Decodes a tuple (A, B) by first decoding A and then using the remaining bits to decode B.

Inherited from
DecoderFunctions
final
def decodeBothCombine[A, B, C](decA: Decoder[A], decB: Decoder[B])(buffer: BitVector)(f: (A, B) => C): Attempt[DecodeResult[C]]

Decodes a C by first decoding A and then using the remaining bits to decode B, then applying the decoded values to the specified function to generate a C.

Decodes a C by first decoding A and then using the remaining bits to decode B, then applying the decoded values to the specified function to generate a C.

Inherited from
DecoderFunctions

Extensions

Extensions

extension [A](decoder: Decoder[A])
def as[B](using iso: Iso[A, B]): Decoder[B]