Crate willow_encoding

Source
Expand description

Utilities for implementing Willow’s various encodings.

Modules§

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

Structs§

U8BE
A u8 wrapper that implements crate::Encodable and crate::Decodable by encoding as a big-endian fixed-width integer.
U16BE
A u16 wrapper that implements crate::Encodable and crate::Decodable by encoding as a big-endian fixed-width integer.
U32BE
A u32 wrapper that implements crate::Encodable and crate::Decodable by encoding as a big-endian fixed-width integer.
U64BE
A u64 wrapper that implements crate::Encodable and crate::Decodable by encoding as a big-endian fixed-width integer.

Enums§

CompactWidth
A minimum width of bytes needed to represent a unsigned integer.
DecodeError
Everything that can go wrong when decoding a value.

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.
is_bitflagged
Return whether a bit at the given position is 1 or not.
max_power
Return the least natural number such that 256^n is greater than or equal to n.
produce_byte
Have Producer produce a single byte, or return an error if the final value was produced or the producer experienced an error.