pub enum Base {
Show 24 variants
Identity,
Base2,
Base8,
Base10,
Base16Lower,
Base16Upper,
Base32Lower,
Base32Upper,
Base32PadLower,
Base32PadUpper,
Base32HexLower,
Base32HexUpper,
Base32HexPadLower,
Base32HexPadUpper,
Base32Z,
Base36Lower,
Base36Upper,
Base58Flickr,
Base58Btc,
Base64,
Base64Pad,
Base64Url,
Base64UrlPad,
Base256Emoji,
}Expand description
List of types currently supported in the multibase spec.
Not all base types are supported by this library.
Variants§
Identity
8-bit binary (encoder and decoder keeps data unmodified).
Base2
Base2 (alphabet: 01).
Base8
Base8 (alphabet: 01234567).
Base10
Base10 (alphabet: 0123456789).
Base16Lower
Base16 lower hexadecimal (alphabet: 0123456789abcdef).
Base16Upper
Base16 upper hexadecimal (alphabet: 0123456789ABCDEF).
Base32Lower
Base32, rfc4648 no padding (alphabet: abcdefghijklmnopqrstuvwxyz234567).
Base32Upper
Base32, rfc4648 no padding (alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ234567).
Base32PadLower
Base32, rfc4648 with padding (alphabet: abcdefghijklmnopqrstuvwxyz234567).
Base32PadUpper
Base32, rfc4648 with padding (alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ234567).
Base32HexLower
Base32hex, rfc4648 no padding (alphabet: 0123456789abcdefghijklmnopqrstuv).
Base32HexUpper
Base32hex, rfc4648 no padding (alphabet: 0123456789ABCDEFGHIJKLMNOPQRSTUV).
Base32HexPadLower
Base32hex, rfc4648 with padding (alphabet: 0123456789abcdefghijklmnopqrstuv).
Base32HexPadUpper
Base32hex, rfc4648 with padding (alphabet: 0123456789ABCDEFGHIJKLMNOPQRSTUV).
Base32Z
z-base-32 (used by Tahoe-LAFS) (alphabet: ybndrfg8ejkmcpqxot1uwisza345h769).
Base36Lower
Base36, [0-9a-z] no padding (alphabet: 0123456789abcdefghijklmnopqrstuvwxyz).
Base36Upper
Base36, [0-9A-Z] no padding (alphabet: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ).
Base58Flickr
Base58 flicker (alphabet: 123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ).
Base58Btc
Base58 bitcoin (alphabet: 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz).
Base64
Base64, rfc4648 no padding (alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/).
Base64Pad
Base64, rfc4648 with padding (alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/).
Base64Url
Base64 url, rfc4648 no padding (alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_).
Base64UrlPad
Base64 url, rfc4648 with padding (alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_).
Base256Emoji
Base256Emoji (alphabet: 🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂)
Implementations§
Source§impl Base
impl Base
Sourcepub fn from_code(code: char) -> Result<Self>
pub fn from_code(code: char) -> Result<Self>
Convert a character code to the matching base algorithm.
Returns Error::UnknownBase if the code doesn’t match any supported base.
Sourcepub fn code(&self) -> char
pub fn code(&self) -> char
Get the character code corresponding to the base algorithm.
Each base encoding has a unique single-character (or emoji) prefix that identifies it in multibase strings.
Sourcepub fn encode<I: AsRef<[u8]>>(&self, input: I) -> String
pub fn encode<I: AsRef<[u8]>>(&self, input: I) -> String
Encode the given byte slice to a base string (without prefix).
This method returns only the encoded data, without the base code prefix.
Use the public encode() function to get the full multibase string.
Sourcepub fn decode<I: AsRef<str>>(&self, input: I, strict: bool) -> Result<Vec<u8>>
pub fn decode<I: AsRef<str>>(&self, input: I, strict: bool) -> Result<Vec<u8>>
Decode the base string (without prefix) back to bytes.
The strict parameter controls whether to accept case-insensitive
input for applicable bases.
§Parameters
input- The encoded string (without the multibase prefix)strict- If true, enforce strict decoding rules (case-sensitive, etc.)
§Errors
Returns an error if the input contains invalid characters for this base or if the input is malformed.