Attach context to the decoder.
The context object can be used to pass some "global" parameters down to custom decoders.
Optionalcontext: unknownDecode a variable-length sequence of bits.
Decode a boolean discriminator.
NOTE: this method will throw an exception in case the encoded byte is neither 0 nor 1.
Decode a variable-length sequence of bytes.
Return the number of bytes read from the source (i.e. current offset within the source).
Return a copy of this decoder.
The copy will maintain it's own offset within the source.
Finish decoding source object and make sure there is no data left.
This method can be called when the entire object that was meant to be
stored in the source is now fully decoded and we want to ensure
that there is no extra bytes contained in the source.
Get the decoding context object.
Decode two bytes as a signed number.
Decode three bytes as a signed number.
Decode 4 bytes as a signed number.
Decode 8 bytes as a signed number.
Decode single byte as a signed number.
Return all remaining bytes as BytesBlob and move offset to the end.
Move the decoding cursor to given offset.
Note the offset can actually be smaller than the current offset (i.e. one can go back).
Skip given number of bytes for decoding.
Decode two bytes as an unsigned number.
Decode three bytes as an unsigned number.
Decode 4 bytes as an unsigned number.
Decode 8 bytes as a unsigned number.
Decode single byte as an unsigned number.
Decode a variable-length encoding of natural numbers (up to 2**32).
NOTE: this method will panic in case a larger number is found in the source.
Decode a variable-length encoding of natural numbers (up to 2**64).
StaticdecodeDecode a single object from all of the source bytes.
NOTE that if you need to decode multiple objects, it might be better
to create a [Decoder] instance intstead of slicing the data.
StaticdecodeStaticfromCreate a new [Decoder] instance given a raw array of bytes as a source.
Optionalcontext: unknownStaticfrom
Primitives decoder for JAM codec.