Expand description
Const-friendly decoding/encoding operations for Uint.
Structsยง
- Encoded
Uint Uintencoded as bytes.- Radix
Division ๐Params - Parameter set used to perform radix encoding by division.
- Slice
Decode ๐ByLimb - Wrap a
Limbslice as a target for decoding - TryFrom
Slice Error - 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ยง
- Decode
ByLimb ๐ - 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
bytesvalues 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_precisionis not aligned toLimb::BITS. - radix_
decode_ ๐str - Decode an ascii string in base
radix, writing the result to theDecodeByLimbinstanceout. - 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
radixvalues which are a power of two, encode the mutable limb slice to the output buffer as ASCII characters in baseradix. Leading zeros are added to fillout. The slicelimbsis 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 valuediv_limbis the largest power ofradixthat can fit within a limb. - radix_
preprocess_ ๐str - Perform basic validation and pre-processing on a digit string