Struct AccumulatingReader

Source
pub struct AccumulatingReader { /* private fields */ }

Implementations§

Source§

impl AccumulatingReader

Source

pub fn new(rd: Box<dyn Read>) -> AccumulatingReader

Source

pub fn refill(&mut self, min_len: usize)

Grow and fill the internal buffer such that at least min_len characters are present, or the end of the file has been reached. This function may shift the buffer contents around, in which case previous buffer indices become invalid. Recalculate all indices derived from base, pos, or tail after a call to this function.

Source

pub fn slice(&self) -> &[u8]

Return a slice of the consumed bytes.

Source

pub fn rem_slice(&self) -> &[u8]

Return a slice of the remaining bytes, starting at the last call to clear().

Trait Implementations§

Source§

impl Reader for AccumulatingReader

Source§

fn peek(&mut self, off: usize) -> Option<char>

Return the value of the byte that is off bytes away from the current position in the input file. If the off lies beyond the end of file, None is returned.

Source§

fn consume(&mut self, amt: usize)

Consume the next amt bytes of the input. All consumed bytes since the last clear() can be accessed via slice() or to_string().

Source§

fn clear(&mut self)

Clear the consumed bytes.

Source§

fn to_string(&self) -> String

Convert the consumed bytes to a String.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.