pub struct TryMap<'input, SliceType: ?Sized, R: Rule<'input, SliceType>, O, E: Error + 'static, Func: Fn(R::Output) -> Result<O, E>> { /* private fields */ }
Expand description
Attempts to map a function over the output of a rule. See Rule::try_map_parsed
.
Trait Implementations§
source§impl<'input, SliceType: Clone + ?Sized, R: Clone + Rule<'input, SliceType>, O: Clone, E: Clone + Error + 'static, Func: Clone + Fn(R::Output) -> Result<O, E>> Clone for TryMap<'input, SliceType, R, O, E, Func>
impl<'input, SliceType: Clone + ?Sized, R: Clone + Rule<'input, SliceType>, O: Clone, E: Clone + Error + 'static, Func: Clone + Fn(R::Output) -> Result<O, E>> Clone for TryMap<'input, SliceType, R, O, E, Func>
source§impl<'input, SliceType: Debug + ?Sized, R: Debug + Rule<'input, SliceType>, O: Debug, E: Debug + Error + 'static, Func: Debug + Fn(R::Output) -> Result<O, E>> Debug for TryMap<'input, SliceType, R, O, E, Func>
impl<'input, SliceType: Debug + ?Sized, R: Debug + Rule<'input, SliceType>, O: Debug, E: Debug + Error + 'static, Func: Debug + Fn(R::Output) -> Result<O, E>> Debug for TryMap<'input, SliceType, R, O, E, Func>
source§impl<'input, SliceType: ?Sized, R: Rule<'input, SliceType>, O, E: Error + 'static, Func: Fn(R::Output) -> Result<O, E>> NamedRule for TryMap<'input, SliceType, R, O, E, Func>
impl<'input, SliceType: ?Sized, R: Rule<'input, SliceType>, O, E: Error + 'static, Func: Fn(R::Output) -> Result<O, E>> NamedRule for TryMap<'input, SliceType, R, O, E, Func>
source§impl<'input, SliceType: PartialEq + ?Sized, R: PartialEq + Rule<'input, SliceType>, O: PartialEq, E: PartialEq + Error + 'static, Func: PartialEq + Fn(R::Output) -> Result<O, E>> PartialEq for TryMap<'input, SliceType, R, O, E, Func>
impl<'input, SliceType: PartialEq + ?Sized, R: PartialEq + Rule<'input, SliceType>, O: PartialEq, E: PartialEq + Error + 'static, Func: PartialEq + Fn(R::Output) -> Result<O, E>> PartialEq for TryMap<'input, SliceType, R, O, E, Func>
source§impl<'input, SliceType: ?Sized, R: Rule<'input, SliceType>, O, E: Error + 'static, Func: Fn(R::Output) -> Result<O, E>> Rule<'input, SliceType> for TryMap<'input, SliceType, R, O, E, Func>
impl<'input, SliceType: ?Sized, R: Rule<'input, SliceType>, O, E: Error + 'static, Func: Fn(R::Output) -> Result<O, E>> Rule<'input, SliceType> for TryMap<'input, SliceType, R, O, E, Func>
source§fn parse_at<'cursor, 'this, 'index>(
&'this self,
input: &'cursor mut &'input SliceType,
index: &'index mut usize,
) -> Result<Self::Output, ParseError>where
'input: 'this,
fn parse_at<'cursor, 'this, 'index>(
&'this self,
input: &'cursor mut &'input SliceType,
index: &'index mut usize,
) -> Result<Self::Output, ParseError>where
'input: 'this,
Parses a rule at a given index with a given input. Read more
source§fn parse<'this>(
&'this self,
input: &'input SliceType,
) -> Result<(&'input SliceType, Self::Output), ParseError>where
'input: 'this,
fn parse<'this>(
&'this self,
input: &'input SliceType,
) -> Result<(&'input SliceType, Self::Output), ParseError>where
'input: 'this,
Parses a given rule at the start of some input. Read more
source§fn map_parsed<Output, F: Fn(Self::Output) -> Output>(
self,
function: F,
) -> Map<'input, SliceType, Self, Output, F>where
Self: Sized,
fn map_parsed<Output, F: Fn(Self::Output) -> Output>(
self,
function: F,
) -> Map<'input, SliceType, Self, Output, F>where
Self: Sized,
Maps an infallible function onto the output of a rule.
source§fn try_map_parsed<Output, E: Error + 'static, F: Fn(Self::Output) -> Result<Output, E>>(
self,
function: F,
) -> TryMap<'input, SliceType, Self, Output, E, F>where
Self: Sized,
fn try_map_parsed<Output, E: Error + 'static, F: Fn(Self::Output) -> Result<Output, E>>(
self,
function: F,
) -> TryMap<'input, SliceType, Self, Output, E, F>where
Self: Sized,
Maps a function onto the output of a rule, passing the error back if it fails.
source§fn repeat_for<const REPS: usize>(
self,
) -> RepeatFor<'input, SliceType, Self, REPS>where
Self: Sized,
fn repeat_for<const REPS: usize>(
self,
) -> RepeatFor<'input, SliceType, Self, REPS>where
Self: Sized,
Repeats this rule a known amount of times.
source§fn repeat(self, reps: usize) -> Repeat<'input, SliceType, Self>where
Self: Sized,
fn repeat(self, reps: usize) -> Repeat<'input, SliceType, Self>where
Self: Sized,
Repeats this rule a set amount of times.
source§fn take(self, at_most: usize) -> Many<'input, SliceType, Self>where
Self: Sized,
fn take(self, at_most: usize) -> Many<'input, SliceType, Self>where
Self: Sized,
Repeats this rule at most a set amount of times.
impl<'input, SliceType: ?Sized, R: Rule<'input, SliceType>, O, E: Error + 'static, Func: Fn(R::Output) -> Result<O, E>> StructuralPartialEq for TryMap<'input, SliceType, R, O, E, Func>
Auto Trait Implementations§
impl<'input, SliceType, R, O, E, Func> Freeze for TryMap<'input, SliceType, R, O, E, Func>
impl<'input, SliceType, R, O, E, Func> RefUnwindSafe for TryMap<'input, SliceType, R, O, E, Func>
impl<'input, SliceType, R, O, E, Func> Send for TryMap<'input, SliceType, R, O, E, Func>
impl<'input, SliceType, R, O, E, Func> Sync for TryMap<'input, SliceType, R, O, E, Func>
impl<'input, SliceType, R, O, E, Func> Unpin for TryMap<'input, SliceType, R, O, E, Func>
impl<'input, SliceType, R, O, E, Func> UnwindSafe for TryMap<'input, SliceType, R, O, E, Func>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)