Struct DecoderReader
pub struct DecoderReader<'e, E: Engine, R: Read> { /* private fields */ }
A Read implementation that decodes base64 data read from an underlying reader.
Examples
use Read;
use Cursor;
use general_purpose;
// use a cursor as the simplest possible `Read` -- in real code this is probably a file, etc.
let mut wrapped_reader = new;
let mut decoder = new;
// handle errors as you normally would
let mut result = Vecnew;
decoder.read_to_end.unwrap;
assert_eq!;
Implementations
impl<'e, E: Engine, R: Read> DecoderReader<'e, E, R>
fn new(reader: R, engine: &'e E) -> SelfCreate a new decoder that will read from the provided reader
r.fn into_inner(self) -> RUnwraps this
DecoderReader, returning the base reader which it reads base64 encoded input from.Because
DecoderReaderperforms internal buffering, the state of the inner reader is unspecified. This function is mainly provided because the inner reader type may provide additional functionality beyond theReadimplementation which may still be useful.
Trait Implementations
impl<'e, E: Engine, R: Read> Debug for DecoderReader<'e, E, R>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<'e, E: Engine, R: Read> Read for DecoderReader<'e, E, R>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>Decode input from the wrapped reader.
Under non-error circumstances, this returns
Okwith the value being the number of bytes written inbuf.Where possible, this function buffers base64 to minimize the number of
read()calls to the delegate reader.Errors
Any errors emitted by the delegate reader are returned. Decoding errors due to invalid base64 are also possible, and will have
io::ErrorKind::InvalidData.
Auto Trait Implementations
impl<'e, E, R> Freeze for DecoderReader<'e, E, R>
where
&'e E: Freeze,
R: Freeze,
impl<'e, E, R> RefUnwindSafe for DecoderReader<'e, E, R>
where
&'e E: RefUnwindSafe,
R: RefUnwindSafe,
impl<'e, E, R> Send for DecoderReader<'e, E, R>
where
&'e E: Send,
R: Send,
impl<'e, E, R> Sync for DecoderReader<'e, E, R>
where
&'e E: Sync,
R: Sync,
impl<'e, E, R> Unpin for DecoderReader<'e, E, R>
where
&'e E: Unpin,
R: Unpin,
impl<'e, E, R> UnsafeUnpin for DecoderReader<'e, E, R>
where
&'e E: UnsafeUnpin,
R: UnsafeUnpin,
impl<'e, E, R> UnwindSafe for DecoderReader<'e, E, R>
where
&'e E: UnwindSafe,
R: UnwindSafe,
Blanket Implementations
impl<T> Any for DecoderReader<'e, E, R>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for DecoderReader<'e, E, R>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for DecoderReader<'e, E, R>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for DecoderReader<'e, E, R>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for DecoderReader<'e, E, R>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for DecoderReader<'e, E, R>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for DecoderReader<'e, E, R>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>