Struct Base64

Source
pub struct Base64<F, E = GeneralPurpose> {
    pub format: F,
    pub engine: E,
}
Available on crate feature base64 only.
Expand description

Takes a FileFormat, encoding any the contents emitted by the format in Base64 before writing to disk, and decoding contents emitted by the format from Base64 before parsing.

Fields§

§format: F

The FileFormat to be used.

§engine: E

The Engine to be used.

Implementations§

Source§

impl<F, E> Base64<F, E>
where E: Engine,

Source

pub const fn new(format: F, engine: E) -> Self

Creates a new Base64, given an engine to encode and decode with.

Source§

impl<F> Base64<F, GeneralPurpose>

Source

pub const fn with_standard(format: F) -> Self

Creates a Base64 using the STANDARD engine.

Source

pub const fn with_standard_no_pad(format: F) -> Self

Creates a Base64 using the STANDARD_NO_PAD engine.

Source

pub const fn with_url_safe(format: F) -> Self

Creates a Base64 using the URL_SAFE engine.

Source

pub const fn with_url_safe_no_pad(format: F) -> Self

Creates a Base64 using the URL_SAFE_NO_PAD engine.

Trait Implementations§

Source§

impl<F: Clone, E: Clone> Clone for Base64<F, E>

Source§

fn clone(&self) -> Base64<F, E>

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<F: Debug, E: Debug> Debug for Base64<F, E>

Source§

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

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

impl<F, E> Default for Base64<F, E>
where F: Default, E: Default,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<F, E, T> FileFormat<T> for Base64<F, E>
where F: FileFormat<T>, E: Engine,

Source§

type FormatError = <F as FileFormat<T>>::FormatError

The type of error to return from to_writer and from_reader.
Source§

fn from_reader<R: Read>(&self, reader: R) -> Result<T, Self::FormatError>

Deserialize a value from a Read stream. Read more
Source§

fn to_writer<W: Write>( &self, writer: W, value: &T, ) -> Result<(), Self::FormatError>

Serialize a value into a Write stream. Read more
Source§

fn from_reader_buffered<R>(&self, reader: R) -> Result<T, Self::FormatError>
where R: Read,

Identical to FileFormat::from_reader, however the provided reader is buffered with BufReader. Read more
Source§

fn from_buffer(&self, buf: &[u8]) -> Result<T, Self::FormatError>

Deserialize a value from a byte vec.
Source§

fn to_writer_buffered<W>( &self, writer: W, value: &T, ) -> Result<(), Self::FormatError>
where W: Write,

Identical to FileFormat::to_writer, however the provided writer is buffered with BufWriter. Read more
Source§

fn to_buffer(&self, value: &T) -> Result<Vec<u8>, Self::FormatError>

Serialize a value into a byte vec.
Source§

impl<F, E, T> FileFormatUtf8<T> for Base64<F, E>
where F: FileFormat<T>, E: Engine,

Source§

fn from_string_buffer(&self, buf: &str) -> Result<T, Self::FormatError>

Deserialize a buffer from a string slice.
Source§

fn to_string_buffer(&self, value: &T) -> Result<String, Self::FormatError>

Serialize a value into a string buffer.
Source§

impl<F: PartialEq, E: PartialEq> PartialEq for Base64<F, E>

Source§

fn eq(&self, other: &Base64<F, E>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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<F: Copy, E: Copy> Copy for Base64<F, E>

Source§

impl<F: Eq, E: Eq> Eq for Base64<F, E>

Source§

impl<F, E> StructuralPartialEq for Base64<F, E>

Auto Trait Implementations§

§

impl<F, E> Freeze for Base64<F, E>
where F: Freeze, E: Freeze,

§

impl<F, E> RefUnwindSafe for Base64<F, E>

§

impl<F, E> Send for Base64<F, E>
where F: Send, E: Send,

§

impl<F, E> Sync for Base64<F, E>
where F: Sync, E: Sync,

§

impl<F, E> Unpin for Base64<F, E>
where F: Unpin, E: Unpin,

§

impl<F, E> UnwindSafe for Base64<F, E>
where F: UnwindSafe, E: UnwindSafe,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.