given_ByteDecoder_BlockHeader

org.sigilaris.node.jvm.runtime.consensus.hotstuff.SnapshotCodecs$package.given_ByteDecoder_BlockHeader

Attributes

Source
SnapshotCodecs.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

override def decode(bytes: ByteVector): Either[DecodeFailure, DecodeResult[BlockHeader]]

Decodes bytes to a value.

Decodes bytes to a value.

Value parameters

bytes

the byte sequence to decode

Attributes

Returns

Either failure or decoded value with remainder

Definition Classes
Source
SnapshotCodecs.scala

Inherited methods

def emap[B](f: BlockHeader => Either[DecodeFailure, B]): ByteDecoder[B]

Creates a new decoder with validation.

Creates a new decoder with validation.

Value parameters

f

function that may fail with DecodeFailure

Attributes

Returns

new decoder for type B

Example
 val positiveDecoder = ByteDecoder[Long].emap { n =>
   Either.cond(n > 0, n, DecodeFailure("Must be positive"))
 }
Inherited from:
ByteDecoder
Source
ByteDecoder.scala

Creates a new decoder by chaining decoders.

Creates a new decoder by chaining decoders.

Value parameters

f

function that creates a decoder based on decoded value

Attributes

Returns

new decoder for type B

Inherited from:
ByteDecoder
Source
ByteDecoder.scala
def map[B](f: BlockHeader => B): ByteDecoder[B]

Creates a new decoder by transforming the decoded value.

Creates a new decoder by transforming the decoded value.

Value parameters

f

function to transform decoded value

Attributes

Returns

new decoder for type B

Inherited from:
ByteDecoder
Source
ByteDecoder.scala
def widen[AA >: BlockHeader]: ByteDecoder[AA]

Widens the decoder to a supertype.

Widens the decoder to a supertype.

Type parameters

AA

the supertype

Attributes

Returns

a decoder for the wider type

Inherited from:
ByteDecoder
Source
ByteDecoder.scala