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> 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§fn from(value: T) -> SimpleState<T>
fn from(value: T) -> SimpleState<T>
Converts to this type from the input type.
Source§impl<'src, T, I> Inspector<'src, I> for SimpleState<T>where
I: Input<'src>,
impl<'src, T, I> Inspector<'src, I> for SimpleState<T>where
I: Input<'src>,
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>,
) -> <SimpleState<T> as Inspector<'src, I>>::Checkpoint
fn on_save<'parse>( &self, _: &Cursor<'src, 'parse, I>, ) -> <SimpleState<T> as Inspector<'src, I>>::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, <SimpleState<T> as Inspector<'src, I>>::Checkpoint>,
)
fn on_rewind<'parse>( &mut self, _: &Checkpoint<'src, 'parse, I, <SimpleState<T> as Inspector<'src, I>>::Checkpoint>, )
This function is called when a combinator rewinds to an earlier state of the parser. Read more
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> UnsafeUnpin for SimpleState<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for SimpleState<T>where
T: 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