pub struct SimpleState<T>(pub T);Expand description
A state type that should be accessible directly from parser.state() and has no special behavior.
This wrapper implements the Inspector trait for you so you don’t have to.
Tuple Fields§
§0: TTrait Implementations§
Source§impl<T: Clone> Clone for SimpleState<T>
impl<T: Clone> Clone for SimpleState<T>
Source§fn clone(&self) -> SimpleState<T>
fn clone(&self) -> SimpleState<T>
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for SimpleState<T>
impl<T: Debug> Debug for SimpleState<T>
Source§impl<T: Default> Default for SimpleState<T>
impl<T: Default> Default for SimpleState<T>
Source§fn default() -> SimpleState<T>
fn default() -> SimpleState<T>
Returns the “default value” for a type. Read more
Source§impl<T> Deref for SimpleState<T>
impl<T> Deref for SimpleState<T>
Source§impl<T> DerefMut for SimpleState<T>
impl<T> DerefMut for SimpleState<T>
Source§impl<T> From<T> for SimpleState<T>
impl<T> From<T> for SimpleState<T>
Source§impl<'src, T, I: Input<'src>> Inspector<'src, I> for SimpleState<T>
impl<'src, T, I: Input<'src>> Inspector<'src, I> for SimpleState<T>
Source§type Checkpoint = ()
type Checkpoint = ()
A type the Inspector can use to revert to a previous state. Read more
Source§fn on_token(&mut self, _: &<I as Input<'src>>::Token)
fn on_token(&mut self, _: &<I as Input<'src>>::Token)
This function is called when a new token is read from the input stream.
Source§fn on_save<'parse>(&self, _: &Cursor<'src, 'parse, I>) -> Self::Checkpoint
fn on_save<'parse>(&self, _: &Cursor<'src, 'parse, I>) -> Self::Checkpoint
This function is called when a combinator saves the current state of the parse.
Source§fn on_rewind<'parse>(
&mut self,
_: &Checkpoint<'src, 'parse, I, Self::Checkpoint>,
)
fn on_rewind<'parse>( &mut self, _: &Checkpoint<'src, 'parse, I, Self::Checkpoint>, )
This function is called when a combinator rewinds to an earlier state of the parser. Read more
impl<T: Copy> Copy for SimpleState<T>
Auto Trait Implementations§
impl<T> Freeze for SimpleState<T>where
T: Freeze,
impl<T> RefUnwindSafe for SimpleState<T>where
T: RefUnwindSafe,
impl<T> Send for SimpleState<T>where
T: Send,
impl<T> Sync for SimpleState<T>where
T: Sync,
impl<T> Unpin for SimpleState<T>where
T: Unpin,
impl<T> UnwindSafe for SimpleState<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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<'p, T> Seq<'p, T> for T
impl<'p, T> Seq<'p, T> for T
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.