pub struct MappedSpan<S: Span, I, F> { /* private fields */ }Expand description
An input wrapper that maps the span type of your input
into your custom span Input::map_span.
Trait Implementations§
Source§impl<'src, S, I: BorrowInput<'src>, F> BorrowInput<'src> for MappedSpan<S, I, F>
impl<'src, S, I: BorrowInput<'src>, F> BorrowInput<'src> for MappedSpan<S, I, F>
Source§impl<S: Clone + Span, I: Clone, F: Clone> Clone for MappedSpan<S, I, F>
impl<S: Clone + Span, I: Clone, F: Clone> Clone for MappedSpan<S, I, F>
Source§fn clone(&self) -> MappedSpan<S, I, F>
fn clone(&self) -> MappedSpan<S, I, F>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'src, S, I, F> ExactSizeInput<'src> for MappedSpan<S, I, F>
impl<'src, S, I, F> ExactSizeInput<'src> for MappedSpan<S, I, F>
Source§impl<'src, S, I: Input<'src>, F> Input<'src> for MappedSpan<S, I, F>
impl<'src, S, I: Input<'src>, F> Input<'src> for MappedSpan<S, I, F>
Source§type Cursor = <I as Input<'src>>::Cursor
type Cursor = <I as Input<'src>>::Cursor
The type used to keep track of the current location in the stream. Read more
Source§type Token = <I as Input<'src>>::Token
type Token = <I as Input<'src>>::Token
The type of singular tokens generated by the input. Read more
Source§type MaybeToken = <I as Input<'src>>::MaybeToken
type MaybeToken = <I as Input<'src>>::MaybeToken
The token type returned by
Input::next_maybe, allowing abstracting over by-value and by-reference inputs. Read moreSource§type Cache = (<I as Input<'src>>::Cache, F)
type Cache = (<I as Input<'src>>::Cache, F)
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(
(cache, _): &mut Self::Cache,
cursor: &mut Self::Cursor,
) -> Option<Self::MaybeToken>
unsafe fn next_maybe( (cache, _): &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(
(cache, mapper): &mut Self::Cache,
range: Range<&Self::Cursor>,
) -> Self::Span
unsafe fn span( (cache, mapper): &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 moreSource§impl<'src, S, I: SliceInput<'src>, F> SliceInput<'src> for MappedSpan<S, I, F>
impl<'src, S, I: SliceInput<'src>, F> SliceInput<'src> for MappedSpan<S, I, F>
Source§type Slice = <I as SliceInput<'src>>::Slice
type Slice = <I as SliceInput<'src>>::Slice
Source§fn full_slice((cache, _): &mut Self::Cache) -> Self::Slice
fn full_slice((cache, _): &mut Self::Cache) -> Self::Slice
Get the full slice of the input Read more
Source§impl<'src, S, I: ValueInput<'src>, F> ValueInput<'src> for MappedSpan<S, I, F>
impl<'src, S, I: ValueInput<'src>, F> ValueInput<'src> for MappedSpan<S, I, F>
impl<S: Copy + Span, I: Copy, F: Copy> Copy for MappedSpan<S, I, F>
impl<'src, S, I, F> StrInput<'src> for MappedSpan<S, I, F>
Auto Trait Implementations§
impl<S, I, F> Freeze for MappedSpan<S, I, F>
impl<S, I, F> RefUnwindSafe for MappedSpan<S, I, F>
impl<S, I, F> Send for MappedSpan<S, I, F>
impl<S, I, F> Sync for MappedSpan<S, I, F>
impl<S, I, F> Unpin for MappedSpan<S, I, F>
impl<S, I, F> UnsafeUnpin for MappedSpan<S, I, F>where
I: UnsafeUnpin,
F: UnsafeUnpin,
impl<S, I, F> UnwindSafe for MappedSpan<S, I, F>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
Source§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.