Struct base64_simd::Base64
source · [−]pub struct Base64 { /* private fields */ }
Expand description
Implementations
sourceimpl Base64
impl Base64
sourcepub const STANDARD_NO_PAD: Self = _
pub const STANDARD_NO_PAD: Self = _
Standard charset without padding.
sourcepub const URL_SAFE_NO_PAD: Self = _
pub const URL_SAFE_NO_PAD: Self = _
URL-safe charset without padding.
sourcepub const fn encoded_length(&self, n: usize) -> usize
pub const fn encoded_length(&self, n: usize) -> usize
Calculates the encoded length.
Panics
This function panics if any of the conditions below is not satisfied:
n <= isize::MAX
sourcepub const fn estimated_decoded_length(&self, n: usize) -> usize
pub const fn estimated_decoded_length(&self, n: usize) -> usize
Estimates the decoded length.
The result is an upper bound which can be used for allocation.
sourcepub fn decoded_length(&self, data: &[u8]) -> Result<usize, Error>
pub fn decoded_length(&self, data: &[u8]) -> Result<usize, Error>
Calculates the decoded length.
The result is a precise value which can be used for allocation.
sourcepub fn encode<'s, 'd>(
&self,
src: &'s [u8],
dst: OutBuf<'d, u8>
) -> Result<&'d mut [u8], Error>
pub fn encode<'s, 'd>(
&self,
src: &'s [u8],
dst: OutBuf<'d, u8>
) -> Result<&'d mut [u8], Error>
Encodes src
and writes to dst
.
Errors
This function returns Err
if:
- The length of
dst
is not enough.
sourcepub fn encode_as_str<'s, 'd>(
&self,
src: &'s [u8],
dst: OutBuf<'d, u8>
) -> Result<&'d mut str, Error>
pub fn encode_as_str<'s, 'd>(
&self,
src: &'s [u8],
dst: OutBuf<'d, u8>
) -> Result<&'d mut str, Error>
sourcepub fn decode<'s, 'd>(
&self,
src: &'s [u8],
dst: OutBuf<'d, u8>
) -> Result<&'d mut [u8], Error>
pub fn decode<'s, 'd>(
&self,
src: &'s [u8],
dst: OutBuf<'d, u8>
) -> Result<&'d mut [u8], Error>
Decodes src
and writes to dst
.
Errors
This function returns Err
if:
- The length of
dst
is not enough. - The content of
src
is invalid.
sourcepub fn decode_inplace<'d>(
&self,
data: &'d mut [u8]
) -> Result<&'d mut [u8], Error>
pub fn decode_inplace<'d>(
&self,
data: &'d mut [u8]
) -> Result<&'d mut [u8], Error>
Decodes data
and writes inplace.
Errors
This function returns Err
if:
- The content of
data
is invalid.
sourcepub fn encode_to_boxed_str(&self, data: &[u8]) -> Box<str>
Available on crate feature alloc
only.
pub fn encode_to_boxed_str(&self, data: &[u8]) -> Box<str>
alloc
only.sourcepub fn decode_to_boxed_bytes(&self, data: &[u8]) -> Result<Box<[u8]>, Error>
Available on crate feature alloc
only.
pub fn decode_to_boxed_bytes(&self, data: &[u8]) -> Result<Box<[u8]>, Error>
alloc
only.Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Base64
impl Send for Base64
impl Sync for Base64
impl Unpin for Base64
impl UnwindSafe for Base64
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more