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
Selfmaps to exactly one bytestring. - Relative
Decodable - A type that can be used to decode
Tfrom a bytestring encoded relative toSelf. This can be used to decode a compact encoding frow whichTcan be derived by anyone withR. - Relative
Encodable - A type that can be used to encode
Tto a bytestring encoded relative toR. This can be used to create more compact encodings from whichTcan be derived by anyone withR.
Functions§
- decode_
compact_ width_ be - Decode the bytes representing a
CompactWidth-bytes integer into ausize. - decode_
max_ power - Decode a
u64fromn-width bytestring, wherenis the least number of bytes needed to representmax_size. - encode_
compact_ width_ be - Encode a
u64integer as acompact_width(value)-byte big-endian integer, and consume that with aBulkConsumer. - encode_
max_ power - Encode a
usizeto an-width unsigned integer, wherenis the least number of bytes needed to representmax_size. - produce_
byte - Have
Producerproduce a single byte, or return an error if the final value was produced or the producer experienced an error.