pub struct IoInput<R> { /* private fields */ }Available on crate feature
std only.Expand description
Input type which supports seekable readers. Uses a BufReader internally to buffer input and
avoid unnecessary IO calls.
Only available with the std feature
Implementations§
Trait Implementations§
Source§impl<'src, R: Read + Seek + 'src> Input<'src> for IoInput<R>
impl<'src, R: Read + Seek + 'src> Input<'src> for IoInput<R>
Source§type Cursor = usize
type Cursor = usize
The type used to keep track of the current location in the stream. Read more
Source§type Span = SimpleSpan
type Span = SimpleSpan
The type of a span on this input. Read more
Source§type MaybeToken = u8
type MaybeToken = u8
The token type returned by
Input::next_maybe, allowing abstracting over by-value and by-reference inputs. Read moreSource§type Cache = IoInput<R>
type Cache = IoInput<R>
A type that contains cached or constant data pertaining to an input. Read more
Source§fn begin(self) -> (Self::Cursor, Self::Cache)
fn begin(self) -> (Self::Cursor, Self::Cache)
Create an initial cursor and cache at the start of the input.
Source§fn cursor_location(cursor: &Self::Cursor) -> usize
fn cursor_location(cursor: &Self::Cursor) -> usize
Return the ‘location’ associated with the given cursor. Read more
Source§unsafe fn next_maybe(
this: &mut Self::Cache,
cursor: &mut Self::Cursor,
) -> Option<Self::MaybeToken>
unsafe fn next_maybe( this: &mut Self::Cache, cursor: &mut Self::Cursor, ) -> Option<Self::MaybeToken>
Pull the next token, if any, from the input. Read more
Source§unsafe fn span(
_this: &mut Self::Cache,
range: Range<&Self::Cursor>,
) -> Self::Span
unsafe fn span( _this: &mut Self::Cache, range: Range<&Self::Cursor>, ) -> Self::Span
Create a span going from the start cursor to the end cursor (exclusive). Read more
Source§fn with_context<S: Span>(self, context: S::Context) -> WithContext<S, Self>where
Self: Sized,
fn with_context<S: Span>(self, context: S::Context) -> WithContext<S, Self>where
Self: Sized,
Add extra context within spans generated by this input. Read more
Source§fn map<T, S, F>(self, eoi: S, f: F) -> MappedInput<'src, T, S, Self, F>where
Self: Sized,
F: Fn(Self::MaybeToken) -> (<Self::MaybeToken as IntoMaybe<'src, Self::Token>>::Proj<T>, <Self::MaybeToken as IntoMaybe<'src, Self::Token>>::Proj<S>) + 'src,
T: 'src,
S: Span + 'src,
fn map<T, S, F>(self, eoi: S, f: F) -> MappedInput<'src, T, S, Self, F>where
Self: Sized,
F: Fn(Self::MaybeToken) -> (<Self::MaybeToken as IntoMaybe<'src, Self::Token>>::Proj<T>, <Self::MaybeToken as IntoMaybe<'src, Self::Token>>::Proj<S>) + 'src,
T: 'src,
S: Span + 'src,
Map tokens of the input into separate token and span types, using the provided function. Read more
Source§fn split_token_span<T, S>(self, eoi: S) -> MappedInput<'src, T, S, Self>
fn split_token_span<T, S>(self, eoi: S) -> MappedInput<'src, T, S, Self>
Take an input (such as a slice) with token type
(T, S) and turns it into one that produces tokens of type T and spans of type S. Read moreSource§fn split_spanned<T, S>(self, eoi: S) -> MappedInput<'src, T, S, Self>where
Self: Input<'src, Token = S::Spanned, MaybeToken = &'src S::Spanned> + Sized,
T: 'src,
S: WrappingSpan<T> + 'src,
fn split_spanned<T, S>(self, eoi: S) -> MappedInput<'src, T, S, Self>where
Self: Input<'src, Token = S::Spanned, MaybeToken = &'src S::Spanned> + Sized,
T: 'src,
S: WrappingSpan<T> + 'src,
Take an input (such as a slice) with token type
T where T is a spanned type, and split it into its inner value and token. Read moreAuto Trait Implementations§
impl<R> Freeze for IoInput<R>where
R: Freeze,
impl<R> RefUnwindSafe for IoInput<R>where
R: RefUnwindSafe,
impl<R> Send for IoInput<R>where
R: Send,
impl<R> Sync for IoInput<R>where
R: Sync,
impl<R> Unpin for IoInput<R>where
R: Unpin,
impl<R> UnsafeUnpin for IoInput<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for IoInput<R>where
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> S::Spanned
fn with_span(self, span: S) -> S::Spanned
Invokes
WrappingSpan::make_wrapped to wrap an AST node in a span.