Struct pex::ChoiceHelper
source · pub struct ChoiceHelper<'a, T> { /* private fields */ }
Expand description
Helper for choice pattern
Implementations§
source§impl<'a, T> ChoiceHelper<'a, T>
impl<'a, T> ChoiceHelper<'a, T>
sourcepub fn new(state: ParseState<'a>) -> Self
pub fn new(state: ParseState<'a>) -> Self
Create a new choice helper
sourcepub fn choose<F>(self, parse: F) -> Selfwhere
F: FnMut(ParseState<'a>) -> ParseResult<'a, T>,
pub fn choose<F>(self, parse: F) -> Selfwhere F: FnMut(ParseState<'a>) -> ParseResult<'a, T>,
Try to parse a value
sourcepub fn choose_from<F, U>(self, parse: F) -> Selfwhere
F: FnMut(ParseState<'a>) -> ParseResult<'a, U>,
T: From<U>,
pub fn choose_from<F, U>(self, parse: F) -> Selfwhere F: FnMut(ParseState<'a>) -> ParseResult<'a, U>, T: From<U>,
Try to parse a value
sourcepub fn end_choice(self) -> ParseResult<'a, T>
pub fn end_choice(self) -> ParseResult<'a, T>
End choice
Trait Implementations§
source§impl<'a, T: Clone> Clone for ChoiceHelper<'a, T>
impl<'a, T: Clone> Clone for ChoiceHelper<'a, T>
source§fn clone(&self) -> ChoiceHelper<'a, T>
fn clone(&self) -> ChoiceHelper<'a, T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<'a, T> RefUnwindSafe for ChoiceHelper<'a, T>where T: RefUnwindSafe,
impl<'a, T> Send for ChoiceHelper<'a, T>where T: Send,
impl<'a, T> Sync for ChoiceHelper<'a, T>where T: Sync,
impl<'a, T> Unpin for ChoiceHelper<'a, T>where T: Unpin,
impl<'a, T> UnwindSafe for ChoiceHelper<'a, 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