Struct parser_fuck::combinators::OrElse
source · pub struct OrElse<B: Parser<I>, I: TimeTravel, F> { /* private fields */ }
Expand description
Pass if subparser pass, otherwise calls f and parse the result Parser
Implementations§
Trait Implementations§
source§impl<B: Parser<I>, I: TimeTravel, U, F> Parser<I> for OrElse<B, I, F>where
U: Parser<I, Output = B::Output>,
F: FnMut() -> U,
impl<B: Parser<I>, I: TimeTravel, U, F> Parser<I> for OrElse<B, I, F>where U: Parser<I, Output = B::Output>, F: FnMut() -> U,
type Output = <B as Parser<I>>::Output
source§fn map<U, F>(self, f: F) -> Map<Self, I, F>where
Self: Sized,
F: FnMut(Self::Output) -> U,
fn map<U, F>(self, f: F) -> Map<Self, I, F>where Self: Sized, F: FnMut(Self::Output) -> U,
Map a
Parser<Output = T>
to Parser<Output = U>
by applying a function to a contained valuesource§fn and<B>(self, b: B) -> And<Self, B, I>where
Self: Sized,
B: Parser<I>,
fn and<B>(self, b: B) -> And<Self, B, I>where Self: Sized, B: Parser<I>,
Only pass if both subparsers pass
source§fn or<B>(self, b: B) -> Or<Self, B, I>where
Self: Sized,
B: Parser<I, Output = Self::Output>,
fn or<B>(self, b: B) -> Or<Self, B, I>where Self: Sized, B: Parser<I, Output = Self::Output>,
Pass when any subparser passes
source§fn many_min_max(self, min: usize, max: usize) -> Many<Self, I>where
Self: Sized,
fn many_min_max(self, min: usize, max: usize) -> Many<Self, I>where Self: Sized,
{n,m}, >= n && <= m
source§fn and_then<U, F>(self, f: F) -> AndThen<Self, I, F>where
Self: Sized,
U: Parser<I>,
F: FnMut(Self::Output) -> U,
fn and_then<U, F>(self, f: F) -> AndThen<Self, I, F>where Self: Sized, U: Parser<I>, F: FnMut(Self::Output) -> U,
Fail if the subparser fail, otherwise calls f with the new Parser and parse the Parser
source§fn or_else<U, F>(self, f: F) -> OrElse<Self, I, F>where
Self: Sized,
U: Parser<I, Output = Self::Output>,
F: FnMut() -> U,
fn or_else<U, F>(self, f: F) -> OrElse<Self, I, F>where Self: Sized, U: Parser<I, Output = Self::Output>, F: FnMut() -> U,
Pass if subparser pass, otherwise calls f and parse the result Parser
source§fn or_trans<F>(self, no_retry: bool, f: F) -> OrTrans<Self, I, F>where
Self: Sized,
F: FnMut(I, Range<usize>) -> Self::Output,
fn or_trans<F>(self, no_retry: bool, f: F) -> OrTrans<Self, I, F>where Self: Sized, F: FnMut(I, Range<usize>) -> Self::Output,
Pass if subparser pass, otherwise calls f with error point Read more
source§impl<B: PartialEq + Parser<I>, I: PartialEq + TimeTravel, F: PartialEq> PartialEq for OrElse<B, I, F>
impl<B: PartialEq + Parser<I>, I: PartialEq + TimeTravel, F: PartialEq> PartialEq for OrElse<B, I, F>
impl<B: Eq + Parser<I>, I: Eq + TimeTravel, F: Eq> Eq for OrElse<B, I, F>
impl<B: Parser<I>, I: TimeTravel, F> StructuralEq for OrElse<B, I, F>
impl<B: Parser<I>, I: TimeTravel, F> StructuralPartialEq for OrElse<B, I, F>
Auto Trait Implementations§
impl<B, I, F> !RefUnwindSafe for OrElse<B, I, F>
impl<B, I, F> Send for OrElse<B, I, F>where B: Send, F: Send, I: Send,
impl<B, I, F> !Sync for OrElse<B, I, F>
impl<B, I, F> Unpin for OrElse<B, I, F>where B: Unpin, F: Unpin, I: Unpin,
impl<B, I, F> UnwindSafe for OrElse<B, I, F>where B: UnwindSafe, F: UnwindSafe, I: 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