pub struct PosTrackingReader<R> { /* private fields */ }
Expand description

Wraps a Reader so that it implements Position<usize>.

Implementations§

source§

impl<R> PosTrackingReader<R>

source

pub fn new<'a>(into_reader: impl IntoReader<'a, Reader = R>) -> Self

Wraps the given Reader so that it implements Position<usize> with the position starting from 0.

Trait Implementations§

source§

impl<R> Position<usize> for PosTrackingReader<R>

source§

fn position(&self) -> usize

Returns the byte index of the current position.
source§

impl<R: Reader> Reader for PosTrackingReader<R>

§

type Error = <R as Reader>::Error

The error returned by this reader.
source§

fn read_char(&mut self) -> Result<Option<char>, Self::Error>

Return a new character from the input stream. Read more
source§

fn try_read_string( &mut self, s: &str, case_sensitive: bool ) -> Result<bool, Self::Error>

Attempt to read an entire string at once, either case-insensitively or not. Read more
source§

fn len_of_char_in_current_encoding(&self, c: char) -> usize

Returns the number of bytes that the given character takes up in the current character encoding.

Auto Trait Implementations§

§

impl<R> RefUnwindSafe for PosTrackingReader<R>
where R: RefUnwindSafe,

§

impl<R> Send for PosTrackingReader<R>
where R: Send,

§

impl<R> Sync for PosTrackingReader<R>
where R: Sync,

§

impl<R> Unpin for PosTrackingReader<R>
where R: Unpin,

§

impl<R> UnwindSafe for PosTrackingReader<R>
where R: UnwindSafe,

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<'a, R> IntoReader<'a> for R
where R: 'a + Reader,

§

type Reader = R

The reader type into which this type should be converted.
source§

fn into_reader(self) -> <R as IntoReader<'a>>::Reader

Convert self into some sort of reader.
source§

impl<R> Position<NoopOffset> for R
where R: Reader,

source§

fn position(&self) -> NoopOffset

Returns the byte index of the current position.
source§

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

§

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>,

§

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.