Struct UpdateState

Source
pub struct UpdateState<P, F>(/* private fields */);

Trait Implementations§

Source§

impl<P: Clone, F: Clone> Clone for UpdateState<P, F>

Source§

fn clone(&self) -> UpdateState<P, F>

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, P, F> Parser<'a> for UpdateState<P, F>
where P: Parser<'a> + 'a, F: Fn(&P::Output, P::State) -> P::State,

Source§

type Output = <P as Parser<'a>>::Output

Source§

type State = <P as Parser<'a>>::State

Source§

fn parse( &mut self, input: &'a str, location: Location, state: Self::State, ) -> ParseResult<'a, Self::Output, Self::State>

Parse a given input, starting at a given location and state.
Source§

fn run( &mut self, input: &'a str, state: Self::State, ) -> ParseResult<'a, Self::Output, Self::State>

Run the parser on a given input, starting at the first character. Read more
Source§

fn map<F, NewOutput: 'a>(self, map_fn: F) -> Map<Self, F>
where Self: Sized + 'a, F: Fn(Self::Output) -> NewOutput + 'a,

Map the output to a new output if parse succeeds. Otherwise, return error as usual. Read more
Source§

fn map_with_state<F, NewOutput: 'a>(self, map_fn: F) -> MapWithState<Self, F>
where Self: Sized + 'a, F: Fn(Self::Output, Self::State) -> NewOutput + 'a,

The map function is supplied both the output and the state of the parser. Otherwise, return error as usual. Read more
Source§

fn map_err<F>(self, map_fn: F) -> MapErr<Self, F>
where Self: Sized + 'a, F: Fn(String) -> String,

Map the error message to a new message if parse fails. Otherwise, return output as usual. Read more
Source§

fn and_then<F, P2, B>(self, f: F) -> AndThen<Self, F>
where Self: Sized + 'a, P2: Parser<'a, Output = B>, F: Fn(Self::Output) -> P2,

Returns a new parser which is given the current output if parse succeeds. Otherwise, return error as usual. Read more
Source§

fn pred<F>(self, predicate: F, expecting: &'a str) -> Pred<'_, Self, F>
where Self: Sized + 'a, F: Fn(&Self::Output) -> bool,

Judge if the output meets the requirement using a predicate function if the parse succeeds. Otherwise, return error as usual.
Source§

fn ignore(self) -> Ignore<Self>
where Self: Sized + 'a,

Ignore the parse output and return () (emtpy tuple)
Source§

fn update_state<F>(self, f: F) -> UpdateState<Self, F>
where Self: Sized + 'a, F: Fn(Self::Output, Self::State) -> Self::State,

Update the state given the new output and state of the parse if parse succeeds. Otherwise, return error as usual.
Source§

fn update<B, F>(self, f: F) -> Update<Self, F>
where Self: Sized + 'a, F: FnOnce(&'a str, Self::Output, Location, Self::State) -> ParseResult<'a, B, Self::State> + Clone,

Update the result of the parser if parse succeeds. Otherwise, return error as usual. Read more
Source§

fn end(self) -> End<Self>
where Self: Sized + 'a,

Check if you have reached the end of the input you are parsing. Read more
Source§

fn keep<A, B, P2>(self, arg_parser: P2) -> Keep<Self, P2>
where Self: Sized + 'a, Self::Output: FnOnce(A) -> B + Clone, P2: Parser<'a, Output = A>,

Keep values in a parser pipeline. Read more
Source§

fn skip<P2>(self, ignored_parser: P2) -> Skip<Self, P2>
where Self: Sized + 'a, P2: Parser<'a>,

Skip values in a parser pipeline. Read more
Source§

fn backtrackable(self) -> Backtrackable<Self>
where Self: Sized + 'a,

Source§

fn first_of_two<T2>(self) -> OneOfTwo<Self, T2>
where Self: Sized + 'a, T2: Parser<'a, Output = Self::Output, State = Self::State>,

Source§

fn second_of_two<T1>(self) -> OneOfTwo<T1, Self>
where Self: Sized + 'a, T1: Parser<'a, Output = Self::Output, State = Self::State>,

Source§

fn first_of_three<T2, T3>(self) -> OneOfThree<Self, T2, T3>
where Self: Sized + 'a, T2: Parser<'a, Output = Self::Output, State = Self::State>, T3: Parser<'a, Output = Self::Output, State = Self::State>,

Source§

fn second_of_three<T1, T3>(self) -> OneOfThree<T1, Self, T3>
where Self: Sized + 'a, T1: Parser<'a, Output = Self::Output, State = Self::State>, T3: Parser<'a, Output = Self::Output, State = Self::State>,

Source§

fn third_of_three<T1, T2>(self) -> OneOfThree<T1, T2, Self>
where Self: Sized + 'a, T1: Parser<'a, Output = Self::Output, State = Self::State>, T2: Parser<'a, Output = Self::Output, State = Self::State>,

Auto Trait Implementations§

§

impl<P, F> Freeze for UpdateState<P, F>
where P: Freeze, F: Freeze,

§

impl<P, F> RefUnwindSafe for UpdateState<P, F>

§

impl<P, F> Send for UpdateState<P, F>
where P: Send, F: Send,

§

impl<P, F> Sync for UpdateState<P, F>
where P: Sync, F: Sync,

§

impl<P, F> Unpin for UpdateState<P, F>
where P: Unpin, F: Unpin,

§

impl<P, F> UnwindSafe for UpdateState<P, F>
where P: UnwindSafe, F: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.