Skip to main content

Base

Enum Base 

Source
pub enum Base {
Show 25 variants Identity, Base2, Base8, Base10, Base16Lower, Base16Upper, Base32Lower, Base32Upper, Base32PadLower, Base32PadUpper, Base32HexLower, Base32HexUpper, Base32HexPadLower, Base32HexPadUpper, Base32Z, Base36Lower, Base36Upper, Base45, 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).

§

Base45

Base45, rfc9285 (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

Source

pub fn from_code(code: char) -> Result<Self>

Convert a number to the matching base algorithm, or Error if no algorithm is matching.

Source

pub fn code(&self) -> char

Get the code corresponding to the base algorithm.

Source

pub fn encode<I: AsRef<[u8]>>(&self, input: I) -> String

Encode the given byte slice to base string.

Source

pub fn decode<I: AsRef<str>>(&self, input: I) -> Result<Vec<u8>>

Decode the base string.

Trait Implementations§

Source§

impl Clone for Base

Source§

fn clone(&self) -> Base

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Base

Source§

impl Debug for Base

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Base

Source§

impl PartialEq for Base

Source§

fn eq(&self, other: &Base) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Base

Auto Trait Implementations§

§

impl Freeze for Base

§

impl RefUnwindSafe for Base

§

impl Send for Base

§

impl Sync for Base

§

impl Unpin for Base

§

impl UnsafeUnpin for Base

§

impl UnwindSafe for Base

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.