Expand description
base62
is a no_std
crate that provides base62 encoding and decoding functionality.
With the alloc
feature (enabled by default), it provides functions for converting
between u128
values and base62 strings using both standard (0-9, A-Z, a-z) and
alternative (0-9, a-z, A-Z) alphabets.
When used without default features, it provides the core encoding and decoding primitives that operate on byte slices.
For usage with the standard library’s IO traits, enable the std
feature.
Enums§
- Decode
Error - Indicates the cause of a decoding failure in base62 decoding operations.
- Encode
Error - Indicates the cause of an encoding failure in encoding operations.
Functions§
- decode
- Decodes a base62 byte slice or an equivalent, like a
String
, using the standard digit ordering (0 to 9, then A to Z, then a to z). - decode_
alternative - Decodes a base62 byte slice or an equivalent, like a
String
, using the alternative digit ordering (0 to 9, then a to z, then A to Z) with lowercase letters before uppercase letters. - encode
- Encodes an unsigned integer into base62, using the standard digit ordering
(0 to 9, then A to Z, then a to z), and returns the resulting
String
. - encode_
alternative - Encodes an unsigned integer into base62, using the alternative digit ordering
(0 to 9, then a to z, then A to Z) with lowercase letters before uppercase letters,
and returns the resulting
String
. - encode_
alternative_ buf - Encodes an unsigned integer into base62, using the alternative digit ordering
(0 to 9, then a to z, then A to Z) with lowercase letters before uppercase letters, and
then appends it onto the end of the given
String
. - encode_
alternative_ bytes - Encodes an unsigned integer into base62, using the alternative digit ordering (0 to 9, then a to z, then A to Z), and writes it to the passed buffer.
- encode_
buf - Encodes an unsigned integer into base62, using the standard digit ordering
(0 to 9, then A to Z, then a to z), and then appends it onto the end of the given
String
. - encode_
bytes - Encodes an unsigned integer into base62, using the standard digit ordering (0 to 9, then A to Z, then a to z), and writes it to the passed buffer.
- encode_
fmt - Writes the base62 representation of a number using the standard alphabet to any fmt::Write destination.
- encode_
fmt_ alt - Writes the base62 representation of a number using the alternative alphabet to any fmt::Write destination.