Skip to main content

SimpleState

Struct SimpleState 

Source
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: T

Trait Implementations§

Source§

impl<T> Deref for SimpleState<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<SimpleState<T> as Deref>::Target

Dereferences the value.
Source§

impl<T> DerefMut for SimpleState<T>

Source§

fn deref_mut(&mut self) -> &mut <SimpleState<T> as Deref>::Target

Mutably dereferences the value.
Source§

impl<T> From<T> for SimpleState<T>

Source§

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

Source§

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)

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

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

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> 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<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

Source§

type Proj<U: 'src> = U

Source§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

Source§

impl<T> IntoResult<T> for T

Source§

type Err = !

Source§

fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.