Nibbles

org.sigilaris.core.merkle.Nibbles$package.Nibbles
object Nibbles

Companion object for Nibbles providing creation and manipulation methods.

Attributes

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

Members list

Type members

Types

type NibbleCond = Length[Multiple[4L]]

Refinement constraint requiring the bit length to be a multiple of 4.

Refinement constraint requiring the bit length to be a multiple of 4.

Attributes

Source
Nibbles.scala

Value members

Concrete methods

def combine(nibbles: Nibbles*): Nibbles

Combines multiple Nibbles into one.

Combines multiple Nibbles into one.

Value parameters

nibbles

sequence of Nibbles to combine

Attributes

Returns

combined Nibbles

Source
Nibbles.scala

Concrete fields

val empty: Nibbles

Empty Nibbles value.

Empty Nibbles value.

Attributes

Source
Nibbles.scala

Givens

Givens

Decodes Nibbles from bytes.

Decodes Nibbles from bytes.

Decoding format: nibble count (BigNat) + nibble bytes

Attributes

Source
Nibbles.scala

Encodes Nibbles to bytes.

Encodes Nibbles to bytes.

Encoding format: nibble count (BigNat) + nibble bytes

Attributes

Source
Nibbles.scala
given nibblesEq: Eq[Nibbles]

Cats Eq instance for Nibbles equality comparison.

Cats Eq instance for Nibbles equality comparison.

Attributes

Source
Nibbles.scala

Extensions

Extensions

extension (bitVector: BitVector)

Converts BitVector to Nibbles without validation.

Converts BitVector to Nibbles without validation.

Attributes

Note

Throws runtime error if the constraint is not satisfied.

Source
Nibbles.scala
def refineToNibble: Either[String, Nibbles]

Converts BitVector to Nibbles with validation.

Converts BitVector to Nibbles with validation.

Attributes

Returns

Right(Nibbles) on success, Left(error) on failure

Source
Nibbles.scala
extension (byteVector: ByteVector)

Converts ByteVector to Nibbles.

Converts ByteVector to Nibbles.

Attributes

Note

ByteVector always has a multiple of 8 bits, so conversion is safe.

Source
Nibbles.scala
extension (nibbles: Nibbles)
def <(that: Nibbles): Boolean

Checks if this Nibbles is lexicographically less than that.

Checks if this Nibbles is lexicographically less than that.

Attributes

Source
Nibbles.scala
def <=(that: Nibbles): Boolean

Checks if this Nibbles is lexicographically less than or equal to that.

Checks if this Nibbles is lexicographically less than or equal to that.

Attributes

Source
Nibbles.scala
def >(that: Nibbles): Boolean

Checks if this Nibbles is lexicographically greater than that.

Checks if this Nibbles is lexicographically greater than that.

Attributes

Source
Nibbles.scala
def >=(that: Nibbles): Boolean

Checks if this Nibbles is lexicographically greater than or equal to that.

Checks if this Nibbles is lexicographically greater than or equal to that.

Attributes

Source
Nibbles.scala
def bytes: ByteVector

Converts to ByteVector.

Converts to ByteVector.

Attributes

Source
Nibbles.scala
def compareTo(that: Nibbles): Int

Compares two Nibbles lexicographically.

Compares two Nibbles lexicographically.

Value parameters

that

the Nibbles to compare with

Attributes

Returns

negative (this < that), 0 (equal), positive (this > that)

Source
Nibbles.scala
def hex: String

Converts to hexadecimal string.

Converts to hexadecimal string.

Attributes

Source
Nibbles.scala
def nibbleSize: Long

Returns the number of nibbles (bit size / 4).

Returns the number of nibbles (bit size / 4).

Attributes

Source
Nibbles.scala
def stripPrefix(prefix: Nibbles): Option[Nibbles]

Removes the given prefix if present.

Removes the given prefix if present.

Value parameters

prefix

the prefix to remove

Attributes

Returns

remainder after removing prefix, or None if prefix not found

Source
Nibbles.scala
def unCons: Option[(Int, Nibbles)]

Splits the first nibble and the remainder.

Splits the first nibble and the remainder.

Attributes

Returns

first nibble value (0-15) and remaining Nibbles, or None if empty

Source
Nibbles.scala
def value: BitVector

Returns the underlying BitVector value.

Returns the underlying BitVector value.

Attributes

Source
Nibbles.scala