Attributes
- Companion
- trait
- Source
- ByteEncoder.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ByteEncoder.type
Members list
Type members
Classlikes
Extension methods for encoding values to bytes.
Extension methods for encoding values to bytes.
Attributes
- Source
- ByteEncoder.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ops.type
Types
Natural number type (non-negative BigInt).
Value members
Givens
Givens
Encodes signed integers using sign-magnitude encoding.
Encodes signed integers using sign-magnitude encoding.
Encoding transformation:
- Positive n: encode (n * 2) as BigNat
- Negative n: encode (n * (-2) + 1) as BigNat
This ensures deterministic encoding while preserving sign information.
Attributes
- See also
-
types.md for BigInt encoding examples
- Source
- ByteEncoder.scala
Encodes natural numbers with variable-length encoding.
Encodes natural numbers with variable-length encoding.
Encoding rules:
- 0x00 ~ 0x80: single byte for values 0-128
- 0x81 ~ 0xf7: [0x80+len][data] for 1-119 byte data
- 0xf8: [0xf8][data] for exactly 120-byte data
- 0xf9 ~ 0xff: [0xf8+(ll-1)][len][data] for 121+ byte data, where ll is at least 2
Attributes
- See also
-
types.md for complete BigNat encoding specification
- Source
- ByteEncoder.scala
Encodes Boolean as a canonical single-byte flag.
Encodes Boolean as a canonical single-byte flag.
Encoding:
- false: 0x00
- true: 0x01
Attributes
- Source
- ByteEncoder.scala
Encodes Byte as single byte.
Automatic derivation for product types (case classes, tuples).
Automatic derivation for product types (case classes, tuples).
Encodes each field in order and concatenates the results.
Attributes
- See also
-
types.md for product encoding details
- Source
- ByteEncoder.scala
Encodes Instant as epoch milliseconds (Long encoding).
Encodes Instant as epoch milliseconds (Long encoding).
Attributes
- See also
-
types.md for Instant encoding rules
- Source
- ByteEncoder.scala
Encodes List as [size:BigNat][elem1][elem2]...[elemN].
Encodes List as [size:BigNat][elem1][elem2]...[elemN].
Preserves order of elements.
Attributes
- See also
-
types.md for List encoding rules
- Source
- ByteEncoder.scala
Encodes Long as 8-byte big-endian representation.
Encodes Map as deterministically sorted Set of tuples.
Encodes Map as deterministically sorted Set of tuples.
Converted to Set[(K, V)] and encoded with Set's deterministic ordering.
Attributes
- See also
-
types.md for Map encoding rules
- Source
- ByteEncoder.scala
Encodes Option as zero or one-element List.
Encodes Option as zero or one-element List.
Encoding:
- None: [0x00]
- Some(x): [0x01][x encoded]
Attributes
- See also
-
types.md for Option encoding rules
- Source
- ByteEncoder.scala
Encodes Set with deterministic ordering.
Encodes Set with deterministic ordering.
Elements are encoded individually, then sorted lexicographically by their byte representation before concatenation. This ensures deterministic encoding regardless of Set iteration order.
Attributes
- See also
-
types.md for Set encoding and sorting rules
- Source
- ByteEncoder.scala
Encodes Unit as empty byte sequence.
Encodes Unit as empty byte sequence.
Attributes
- See also
-
types.md for Unit encoding rules
- Source
- ByteEncoder.scala