pub struct Base64 { /* private fields */ }Expand description
Base64 encoding implementation (RFC 4648).
Implementations§
Source§impl Base64
impl Base64
Sourcepub const fn new(serialised: EncodedString) -> Self
pub const fn new(serialised: EncodedString) -> Self
Create a new Base64 instance.
Sourcepub fn get_serialised(self) -> EncodedString
pub fn get_serialised(self) -> EncodedString
Get the serialised data.
Sourcepub fn try_to_base64(bytes: &[u8]) -> Result<String, SerialiseError>
pub fn try_to_base64(bytes: &[u8]) -> Result<String, SerialiseError>
Sourcepub fn try_from_base64(
base64: &str,
size: usize,
) -> Result<Vec<u8>, SerialiseError>
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 Encoder for Base64
impl Encoder for Base64
Source§fn try_encode(bytes: Arc<Vec<u8>>) -> Result<EncodedString, SerialiseError>
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>
fn try_decode(encoded: &EncodedString) -> Result<Arc<Vec<u8>>, SerialiseError>
Attempts to decode a string back into bytes Read more
Auto Trait Implementations§
impl Freeze for Base64
impl RefUnwindSafe for Base64
impl Send for Base64
impl Sync for Base64
impl Unpin for Base64
impl UnsafeUnpin for Base64
impl UnwindSafe for Base64
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