Struct DecoderReader
struct DecoderReader<'e, E: Engine, R: io::Read> { ... }
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: io::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: 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.
impl<'e, E, R> Freeze for DecoderReader<'e, E, R>
impl<'e, E, R> RefUnwindSafe for DecoderReader<'e, E, R>
impl<'e, E, R> Send for DecoderReader<'e, E, R>
impl<'e, E, R> Sync for DecoderReader<'e, E, R>
impl<'e, E, R> Unpin for DecoderReader<'e, E, R>
impl<'e, E, R> UnsafeUnpin for DecoderReader<'e, E, R>
impl<'e, E, R> UnwindSafe for DecoderReader<'e, E, R>
impl<'e, E: Engine, R: io::Read> Debug for DecoderReader<'e, E, R>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<'e, E: Engine, R: io::Read> Read for DecoderReader<'e, E, R>
fn read(self: &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.
impl<T> Any for DecoderReader<'e, E, R>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for DecoderReader<'e, E, R>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for DecoderReader<'e, E, R>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for DecoderReader<'e, E, R>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into for DecoderReader<'e, E, R>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for DecoderReader<'e, E, R>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for DecoderReader<'e, E, R>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>