Module sync

Source
Expand description

Synchronous variants of utilities for implementing Willow’s various encodings.

Traits§

Decodable
A type that can be decoded from a bytestring, ensuring that every valid encoding maps to exactly one member of Self.
Encodable
A type that can be encoded to a bytestring, ensuring that any value of Self maps to exactly one bytestring.
RelativeDecodable
A type that can be used to decode T from a bytestring encoded relative to Self. This can be used to decode a compact encoding frow which T can be derived by anyone with R.
RelativeEncodable
A type that can be used to encode T to a bytestring encoded relative to R. This can be used to create more compact encodings from which T can be derived by anyone with R.

Functions§

decode_compact_width_be
Decode the bytes representing a CompactWidth-bytes integer into a usize.
decode_max_power
Decode a u64 from n-width bytestring, where n is the least number of bytes needed to represent max_size.
encode_compact_width_be
Encode a u64 integer as a compact_width(value)-byte big-endian integer, and consume that with a BulkConsumer.
encode_max_power
Encode a usize to a n-width unsigned integer, where n is the least number of bytes needed to represent max_size.
produce_byte
Have Producer produce a single byte, or return an error if the final value was produced or the producer experienced an error.