Struct base64_simd::Base64
source · pub struct Base64 { /* private fields */ }
Expand description
Implementations§
source§impl 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.