And

Struct And 

Source
pub struct And<P1, P2>(/* private fields */);
Expand description

Execute the two parsers in succession and return them as tuples.

§Example

use chasa::prelude::*;
assert_eq!(any.and(any).parse_ok("aa"), Some(('a','a')))

Trait Implementations§

Source§

impl<P1: Clone, P2: Clone> Clone for And<P1, P2>

Source§

fn clone(&self) -> And<P1, P2>

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

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

Performs copy-assignment from source. Read more
Source§

impl<I: InputOnce, O1, O2, E: ParseError<I>, C, S, P1: Parser<I, O1, E, C, S>, P2: Parser<I, O2, E, C, S>> Parser<I, (O1, O2), E, C, S> for And<P1, P2>

Source§

fn run(&mut self, args: Args<'_, '_, I, E, C, S>) -> Option<(O1, O2)>

Source§

fn by_ref(&mut self) -> MutParser<'_, Self>
where Self: Sized,

Source§

fn or_with<R, F: FnMut(R) -> Q, Q: ParserOnce<I, O, E, C, S>>( self, resource: R, f: F, ) -> OrWith<Self, R, F>
where Self: Sized,

Source§

fn case<F: for<'a, 'b> FnMut(O, Args<'a, 'b, I, E, C, S>) -> Cont<'a, 'b, I, O2, E, C, S>, O2>( self, f: F, ) -> Case<Self, F, O, E>
where Self: Sized,

Source§

fn and_then<F: FnMut(O) -> Result<O2, M>, O2, M>( self, f: F, ) -> AndThen<Self, F, M, O>
where Self: Sized, E: MessageFrom<M>,

Source§

fn map<F: FnMut(O) -> O2, O2>(self, f: F) -> Map<Self, F, O>
where Self: Sized,

Source§

fn bind<F: FnMut(O) -> P, P: ParserOnce<I, O2, E, C, S>, O2>( self, f: F, ) -> Bind<Self, F, O>
where Self: Sized,

Source§

fn fold<T, F: FnMut(T, O) -> T>(self, init: T, f: F) -> Fold<T, Self, F, O>
where Self: Sized,

Source§

fn fold1<T, F: FnMut(T, O) -> T>(self, init: T, f: F) -> Fold1<T, Self, F, O>
where Self: Sized,

Source§

fn sep_fold<T, F: FnMut(T, O) -> T, P: Parser<I, U, E, C, S>, U>( self, init: T, sep: P, f: F, ) -> SepFold<T, Self, P, F, O, U>
where Self: Sized,

Source§

fn sep_reduce<T, F: FnMut(O, T, O) -> O, P: Parser<I, T, E, C, S>, U>( self, sep: P, f: F, ) -> SepReduce<Self, P, F, U>
where Self: Sized,

Source§

fn sep_fold1<T, F: FnMut(T, O) -> T, P: Parser<I, U, E, C, S>, U>( self, init: T, sep: P, f: F, ) -> SepFold1<T, Self, P, F, O, U>
where Self: Sized,

Source§

fn extend<T>(self, value: T) -> ExtendParser<T, Self, O>
where Self: Sized,

Source§

fn extend1<T>(self, value: T) -> Extend1Parser<T, Self, O>
where Self: Sized,

Source§

fn sep_extend<T: Extend<O>, P: Parser<I, U, E, C, S>, U>( self, init: T, sep: P, ) -> SepExtend<T, Self, P, O, U>
where Self: Sized,

Source§

fn sep_extend1<T: Extend<O>, P: Parser<I, U, E, C, S>, U>( self, init: T, sep: P, ) -> SepExtend1<T, Self, P, O, U>
where Self: Sized,

Source§

fn skip_many(self) -> ExtendParser<(), Value<Self, (), O>, ()>
where Self: Sized, I: Save, S: Save,

Source§

fn skip_many1(self) -> Extend1Parser<(), Value<Self, (), O>, ()>
where Self: Sized, I: Save, S: Save,

Source§

fn many<T: FromIterator<O>>(self) -> Many<Self, T, O>
where Self: Sized, I: Save, S: Save,

Source§

fn many1<T: FromIterator<O>>(self) -> Many1<Self, T, O>
where Self: Sized, I: Save, S: Save,

Source§

fn many_map<T, F: FnMut(ManyIterator<'_, '_, Self, I, O, E, C, S>) -> T>( self, f: F, ) -> ManyMap<Self, F, O>
where Self: Sized,

Source§

fn many_map_once<T, F: FnOnce(ManyIterator<'_, '_, Self, I, O, E, C, S>) -> T>( self, f: F, ) -> ManyMap<Self, F, O>
where Self: Sized,

Source§

fn many_bind<O2, P: ParserOnce<I, O2, E, C, S>, F: FnMut(ManyIterator<'_, '_, Self, I, O, E, C, S>) -> P>( self, f: F, ) -> ManyBind<Self, F, O>
where Self: Sized,

Source§

fn many_bind_once<O2, P: ParserOnce<I, O2, E, C, S>, F: FnOnce(ManyIterator<'_, '_, Self, I, O, E, C, S>) -> P>( self, f: F, ) -> ManyBind<Self, F, O>
where Self: Sized,

Source§

fn sep<T: FromIterator<O>, P: Parser<I, U, E, C, S>, U>( self, sep: P, ) -> Sep<Self, P, T, O, U>
where Self: Sized,

Source§

fn sep1<T: FromIterator<O>, P: Parser<I, U, E, C, S>, U>( self, sep: P, ) -> Sep1<Self, P, T, O, U>
where Self: Sized,

Source§

fn sep_map<T, F: FnMut(SepIterator<'_, '_, Self, P, I, O, U, E, C, S>) -> T, P: Parser<I, U, E, C, S>, U>( self, sep: P, f: F, ) -> SepMap<Self, P, F, O, U>
where Self: Sized,

Source§

fn sep_map_once<T, F: FnOnce(SepIterator<'_, '_, Self, P, I, O, U, E, C, S>) -> T, P: Parser<I, U, E, C, S>, U>( self, sep: P, f: F, ) -> SepMap<Self, P, F, O, U>
where Self: Sized,

Source§

fn sep_bind<O2, F: FnMut(SepIterator<'_, '_, Self, P, I, O, T, E, C, S>) -> Q, P: Parser<I, T, E, C, S>, T, Q: ParserOnce<I, O2, E, C, S>>( self, sep: P, f: F, ) -> SepBind<Self, P, F, O, T>
where Self: Sized,

Source§

fn sep_bind_once<O2, F: FnOnce(SepIterator<'_, '_, Self, P, I, O, T, E, C, S>) -> Q, P: Parser<I, T, E, C, S>, T, Q: ParserOnce<I, O2, E, C, S>>( self, sep: P, f: F, ) -> SepBind<Self, P, F, O, T>
where Self: Sized,

Source§

fn repeat<T: FromIterator<O>, N: RangeWithOrd<usize>>( self, count: N, ) -> Repeat<Self, T, O>
where Self: Sized,

Source§

impl<I: InputOnce, O1, O2, E: ParseError<I>, C, S, P1: ParserOnce<I, O1, E, C, S>, P2: ParserOnce<I, O2, E, C, S>> ParserOnce<I, (O1, O2), E, C, S> for And<P1, P2>

Source§

fn run_once(self, args: Args<'_, '_, I, E, C, S>) -> Option<(O1, O2)>

Source§

fn case_once<F: for<'a, 'b> FnOnce(O, Args<'a, 'b, I, E, C, S>) -> Cont<'a, 'b, I, O2, E, C, S>, O2>( self, f: F, ) -> Case<Self, F, O, E>
where Self: Sized,

Source§

fn and_then_once<F: FnOnce(O) -> Result<O2, M>, O2, M>( self, f: F, ) -> AndThen<Self, F, M, O>
where Self: Sized, E: MessageFrom<M>,

Source§

fn map_once<F: FnOnce(O) -> O2, O2>(self, f: F) -> Map<Self, F, O>
where Self: Sized,

Source§

fn to<O2>(self, value: O2) -> Value<Self, O2, O>
where Self: Sized,

Source§

fn skip(self) -> Value<Self, (), O>
where Self: Sized,

Source§

fn label<L>(self, label: L) -> Label<Self, L>
where Self: Sized, E: MessageFrom<Expected<Format<L>>>,

Source§

fn label_with<F: FnMut() -> L, L>(self, label: F) -> LabelWith<Self, F>
where Self: Sized, E: MessageFrom<Expected<Format<L>>>,

Source§

fn bind_once<F: FnOnce(O) -> P, P: ParserOnce<I, O2, E, C, S>, O2>( self, f: F, ) -> Bind<Self, F, O>
where Self: Sized,

Source§

fn or<P: ParserOnce<I, O, E, C, S>>(self, other: P) -> Or<Self, P>
where Self: Sized,

Source§

fn or_not(self) -> OrNot<Self>
where Self: Sized,

Source§

fn or_with_once<R, F: FnOnce(R) -> Q, Q: ParserOnce<I, O, E, C, S>>( self, resource: R, f: F, ) -> OrWith<Self, R, F>
where Self: Sized,

Source§

fn between<P1: ParserOnce<I, Output1, E, C, S>, P2: ParserOnce<I, Output2, E, C, S>, Output1, Output2>( self, left: P1, right: P2, ) -> Between<P1, Self, P2, Output1, Output2>
where Self: Sized,

Source§

fn cut(self) -> Cut<Self>
where Self: Sized,

Source§

fn ranged(self) -> Ranged<Self>
where Self: Sized,

Source§

fn and<P: ParserOnce<I, O2, E, C, S>, O2>(self, other: P) -> And<Self, P>
where Self: Sized,

Source§

fn left<P: ParserOnce<I, O2, E, C, S>, O2>(self, other: P) -> Left<Self, P, O2>
where Self: Sized,

Source§

fn right<P: ParserOnce<I, O2, E, C, S>, O2>(self, other: P) -> Right<Self, P, O>
where Self: Sized,

Source§

fn get_str<B: FromIterator<I::Token>>(self) -> GetString<Self, B>
where Self: Sized,

Source§

fn get_str_extend<B: Extend<I::Token>>( self, value: B, ) -> GetStringExtend<Self, B>
where Self: Sized,

Source§

impl<P1: Copy, P2: Copy> Copy for And<P1, P2>

Auto Trait Implementations§

§

impl<P1, P2> Freeze for And<P1, P2>
where P1: Freeze, P2: Freeze,

§

impl<P1, P2> RefUnwindSafe for And<P1, P2>

§

impl<P1, P2> Send for And<P1, P2>
where P1: Send, P2: Send,

§

impl<P1, P2> Sync for And<P1, P2>
where P1: Sync, P2: Sync,

§

impl<P1, P2> Unpin for And<P1, P2>
where P1: Unpin, P2: Unpin,

§

impl<P1, P2> UnwindSafe for And<P1, P2>
where P1: UnwindSafe, P2: 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> Save for T
where T: Clone,

Source§

type Savepoint = T

Source§

fn save(&mut self) -> <T as Save>::Savepoint

Source§

fn load(&mut self, savepoint: <T as Save>::Savepoint)

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.