Struct Alphabet
pub struct Alphabet { /* private fields */ }
An alphabet defines the 64 ASCII characters (symbols) used for base64.
Common alphabets are provided as constants, and custom alphabets
can be made via from_str or the TryFrom<str> implementation.
Examples
Building and using a custom Alphabet:
let custom = new.unwrap;
let engine = new;
Building a const:
use Alphabet;
static CUSTOM: Alphabet = ;
Building lazily:
use Alphabet;
use LazyLock;
static CUSTOM: = new;
Implementations
impl Alphabet
const fn new(alphabet: &str) -> Result<Self, ParseAlphabetError>Create an
Alphabetfrom a string of 64 unique printable ASCII bytes with=as the padding symbol.The padding symbol
=is not allowed in the alphabet.See
Self::new_with_paddingif a non-default padding symbol is needed.const fn new_with_padding(alphabet: &str, padding: Symbol) -> Result<Self, ParseAlphabetError>Create an
Alphabetfrom a string of 64 unique printable ASCII bytes, with a custom padding symbol.The padding symbol must not appear in the alphabet.
This is meant for strange alphabets that don't use
=as the padding symbol.fn as_str(&self) -> &strA
&strcontaining the symbols in theAlphabet(excluding padding)fn symbols(&self) -> [Symbol; 64]The 64 symbols of the alphabet (excluding padding).
fn padding(&self) -> SymbolThe symbol used for padding.
Trait Implementations
impl Clone for Alphabet
fn clone(&self) -> Alphabet
impl Debug for Alphabet
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for Alphabet
impl PartialEq for Alphabet
fn eq(&self, other: &Alphabet) -> bool
impl StructuralPartialEq for Alphabet
impl TryFrom<&str> for Alphabet
type Error = ParseAlphabetError;fn try_from(value: &str) -> Result<Self, Self::Error>
Auto Trait Implementations
impl Freeze for Alphabet
impl RefUnwindSafe for Alphabet
impl Send for Alphabet
impl Sync for Alphabet
impl Unpin for Alphabet
impl UnsafeUnpin for Alphabet
impl UnwindSafe for Alphabet
Blanket Implementations
impl<T> Any for Alphabet
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Alphabet
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Alphabet
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Alphabet
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Alphabet
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Alphabet
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Alphabet
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Alphabet
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Alphabet
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>