pub struct Decoder<'i, E: Variant> { /* private fields */ }
Expand description
Stateful Base64 decoder with support for buffered, incremental decoding.
The E
type parameter can be any type which impls Encoding
such as
Base64
or Base64Unpadded
.
Internally it uses a sealed Variant
trait which is an implementation
detail of this crate, and leverages a blanket impl of Encoding
.
Implementations
Create a new decoder for a byte slice containing contiguous (non-newline-delimited) Base64-encoded data.
Returns
Ok(decoder)
on success.Err(Error::InvalidLength)
if the input buffer is empty.
Create a new decoder for a byte slice containing Base64 which line wraps at the given line length.
Trailing newlines are not supported and must be removed in advance.
Newlines are handled according to what are roughly RFC7468 conventions:
[parsers] MUST handle different newline conventions
RFC7468 allows any of the following as newlines, and allows a mixture of different types of newlines:
eol = CRLF / CR / LF
Returns
Ok(decoder)
on success.Err(Error::InvalidLength)
if the input buffer is empty or the line width is zero.
Fill the provided buffer with data decoded from Base64.
Enough Base64 input data must remain to fill the entire buffer.
Returns
Ok(bytes)
if the expected amount of data was readErr(Error::InvalidLength)
if the exact amount of data couldn’t be read
Has all of the input data been decoded?
Trait Implementations
Auto Trait Implementations
impl<'i, E> RefUnwindSafe for Decoder<'i, E> where
E: RefUnwindSafe,
impl<'i, E> UnwindSafe for Decoder<'i, E> where
E: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more