pub struct Base64<C = Base64> { /* private fields */ }
Expand description
A wrapper around Vec<u8>
that (de)serializes from / to a base64 string.
The generic parameter C
represents the base64 flavor.
Implementations§
source§impl<C: Encoding> Base64<C>
impl<C: Encoding> Base64<C>
sourcepub fn new(bytes: Vec<u8>) -> Self
pub fn new(bytes: Vec<u8>) -> Self
Create a Base64
instance from raw bytes, to be base64-encoded in
serialization.
sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Get a reference to the raw bytes held by this Base64
instance.
sourcepub fn encode(&self) -> String
pub fn encode(&self) -> String
Encode the bytes contained in this Base64
instance to unpadded base64.
sourcepub fn into_inner(self) -> Vec<u8> ⓘ
pub fn into_inner(self) -> Vec<u8> ⓘ
Get the raw bytes held by this Base64
instance.
Trait Implementations§
source§impl<'de, C: Encoding> Deserialize<'de> for Base64<C>
impl<'de, C: Encoding> Deserialize<'de> for Base64<C>
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<C: Ord> Ord for Base64<C>
impl<C: Ord> Ord for Base64<C>
source§impl<C: PartialOrd> PartialOrd for Base64<C>
impl<C: PartialOrd> PartialOrd for Base64<C>
impl<C: Eq> Eq for Base64<C>
impl<C> StructuralPartialEq for Base64<C>
Auto Trait Implementations§
impl<C> Freeze for Base64<C>
impl<C> RefUnwindSafe for Base64<C>
impl<C> Send for Base64<C>
impl<C> Sync for Base64<C>
impl<C> Unpin for Base64<C>
impl<C> UnwindSafe for Base64<C>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more