Attributes
- Companion
- trait
- Source
- ByteDecoder.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ByteDecoder.type
Members list
Type members
Classlikes
Extension methods for decoding bytes to values.
Extension methods for decoding bytes to values.
Attributes
- Source
- ByteDecoder.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ops.type
Types
Natural number type (non-negative BigInt).
Value members
Concrete methods
Summons a ByteDecoder instance for type A.
Creates a decoder that always fails with the given message.
Creates a decoder that always fails with the given message.
Type parameters
- A
-
the target type (never actually produced)
Value parameters
- msg
-
the failure message
Attributes
- Returns
-
a decoder that always returns a DecodeFailure
- Source
- ByteDecoder.scala
Creates a decoder for fixed-size byte representations.
Creates a decoder for fixed-size byte representations.
Value parameters
- f
-
function to convert bytes to value
- size
-
number of bytes to consume
Attributes
- Returns
-
decoder that reads exactly size bytes
- Source
- ByteDecoder.scala
Creates a decoder for List with known size.
Creates a decoder for List with known size.
Type parameters
- A
-
the element type
Value parameters
- size
-
number of elements to decode
Attributes
- Returns
-
decoder that reads exactly size elements
- Source
- ByteDecoder.scala
Attributes
- Source
- ByteDecoder.scala
Unsafe conversion from BigInt to BigNat (internal use).
Givens
Givens
Decodes signed integers using sign-magnitude decoding.
Decodes signed integers using sign-magnitude decoding.
Decoding transformation:
- Even x: decode as x / 2
- Odd x: decode as (x - 1) / (-2)
This is the inverse of BigInt encoding.
Attributes
- See also
-
types.md for BigInt decoding examples
- Source
- ByteDecoder.scala
Decodes natural numbers with variable-length encoding.
Decodes natural numbers with variable-length encoding.
Decoding rules:
- 0x00 ~ 0x80: value is the byte itself
- 0x81 ~ 0xf8: length = byte - 0x80, read 1-120 data bytes
- 0xf9 ~ 0xff: read a canonical 2-8 byte length, then 121+ data bytes
Rejects leading-zero magnitudes, redundant short form for single-byte values, long form for magnitudes of 120 bytes or fewer, over-wide length fields, truncated input, and lengths above Long.MaxValue.
Attributes
- See also
-
types.md for complete BigNat decoding specification
- Source
- ByteDecoder.scala
Decodes Boolean from a canonical single-byte flag.
Decodes Boolean from a canonical single-byte flag.
Accepted encodings:
- 0x00: false
- 0x01: true
Any other leading byte fails.
Attributes
- Source
- ByteDecoder.scala
Decodes Byte as single byte.
Automatic derivation for product types (case classes, tuples).
Automatic derivation for product types (case classes, tuples).
Decodes each field in order.
Attributes
- See also
-
types.md for product decoding details
- Source
- ByteDecoder.scala
Decodes Instant from epoch milliseconds (Long decoding).
Decodes Instant from epoch milliseconds (Long decoding).
Attributes
- See also
-
types.md for Instant decoding rules
- Source
- ByteDecoder.scala
Decodes Long as 8-byte big-endian representation.
Decodes Map from deterministically ordered tuples.
Decodes Map from deterministically ordered tuples.
Reads size as BigNat, then decodes list of tuples, converting to Map.
Attributes
- See also
-
types.md for Map decoding rules
- Source
- ByteDecoder.scala
Decodes Option as zero or one-element List.
Decodes Option as zero or one-element List.
Reads size as BigNat, then decodes list, taking head as Option.
Attributes
- See also
-
types.md for Option decoding rules
- Source
- ByteDecoder.scala
Decodes Set from deterministically ordered elements.
Decodes Set from deterministically ordered elements.
Reads size as BigNat, then decodes list, converting to Set.
Attributes
- See also
-
types.md for Set decoding rules
- Source
- ByteDecoder.scala
Decodes Unit (consumes no bytes).
Decodes Unit (consumes no bytes).
Attributes
- See also
-
types.md for Unit decoding rules
- Source
- ByteDecoder.scala