Crate base62

Source
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.

Build status Crates.io Docs

Enums§

DecodeError
Indicates the cause of a decoding failure in base62 decoding operations.
EncodeError
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.