Skip to main content

Module encoding

Module encoding 

Source
Expand description

Const-friendly decoding/encoding operations for Uint.

Structsยง

EncodedUint
Uint encoded as bytes.
RadixDivisionParams ๐Ÿ”’
Parameter set used to perform radix encoding by division.
SliceDecodeByLimb ๐Ÿ”’
Wrap a Limb slice as a target for decoding
TryFromSliceError
Returned if an object cannot be instantiated from the given byte slice.

Constantsยง

RADIX_ENCODING_LIMBS_LARGE ๐Ÿ”’
RADIX_ENCODING_MAX ๐Ÿ”’
RADIX_ENCODING_MIN ๐Ÿ”’
RADIX_ENCODING_THRESHOLD_LARGE ๐Ÿ”’

Traitsยง

DecodeByLimb ๐Ÿ”’
Allow decoding of integers into fixed and variable-length types

Functionsยง

cast_slice ๐Ÿ”’
cast_slice_mut ๐Ÿ”’
decode_hex_byte ๐Ÿ”’
Decode a single byte encoded as two hexadecimal characters. Second element of the tuple is non-zero if the bytes values are not in the valid range (0-9, a-z, A-Z).
decode_nibble ๐Ÿ”’
Decode a single nibble of upper or lower hex
fill_limbs_from_be_slice_truncated ๐Ÿ”’
Common implementation of a truncating big endian decoder which supports partial inputs and truncates inputs larger than the provided bits_precision.
fill_limbs_from_le_slice_truncated ๐Ÿ”’
Common implementation of a truncating little endian decoder which supports partial inputs and truncates inputs larger than the provided bits_precision.
mask_high_limb ๐Ÿ”’
Handle masking for the case that bits_precision is not aligned to Limb::BITS.
radix_decode_str ๐Ÿ”’
Decode an ascii string in base radix, writing the result to the DecodeByLimb instance out.
radix_decode_str_aligned_digits ๐Ÿ”’
Decode digits for bases where an integer number of characters can represent a saturated Limb (specifically 2, 4, and 16).
radix_decode_str_digits ๐Ÿ”’
Decode a string of digits in base radix
radix_encode_limbs_by_shifting ๐Ÿ”’
For radix values which are a power of two, encode the mutable limb slice to the output buffer as ASCII characters in base radix. Leading zeros are added to fill out. The slice limbs is used as a working buffer. Output will be truncated if the provided buffer is too small.
radix_encode_limbs_mut_to_string ๐Ÿ”’
Encode a slice of limbs to a string in base radix. The contents of the slice will be used as a working buffer. The result will have no leading zeros unless the value itself is zero.
radix_encode_limbs_to_string ๐Ÿ”’
Encode a slice of limbs to a string in base radix. The result will have no leading zeros unless the value itself is zero.
radix_large_divisor ๐Ÿ”’
Compute the maximum radix divisor for a number of limbs. Returns a pair of the large divisor value and the number of digits, such that divisor = radix ** digits. The value div_limb is the largest power of radix that can fit within a limb.
radix_preprocess_str ๐Ÿ”’
Perform basic validation and pre-processing on a digit string