Skip to main content

Base64

Struct Base64 

Source
pub struct Base64 { /* private fields */ }
Expand description

Base64 encoding implementation (RFC 4648).

Implementations§

Source§

impl Base64

Source

pub const fn new(serialised: EncodedString) -> Self

Create a new Base64 instance.

Source

pub fn get_serialised(self) -> EncodedString

Get the serialised data.

Source

pub fn try_to_base64(bytes: &[u8]) -> Result<String, SerialiseError>

Convert bytes to base64 string.

§Errors

This function currently does not return an error.

Source

pub fn try_from_base64( base64: &str, size: usize, ) -> Result<Vec<u8>, SerialiseError>

Decodes a base64 string into bytes, optionally left-padding to size.

§Errors

Returns Err if base64 contains characters outside the base64 alphabet.

Returns Err if the decoded value requires more than size bytes when size > 0.

Trait Implementations§

Source§

impl Debug for Base64

Source§

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

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

impl Encoder for Base64

Source§

fn try_encode(bytes: Arc<Vec<u8>>) -> Result<EncodedString, SerialiseError>

Attempts to encode bytes into a string representation Read more
Source§

fn try_decode(encoded: &EncodedString) -> Result<Arc<Vec<u8>>, SerialiseError>

Attempts to decode a string back into bytes Read more

Auto Trait Implementations§

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> 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, 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.