pub struct Map<'input, SliceType: ?Sized, R: Rule<'input, SliceType>, O, Func: Fn(R::Output) -> O> { /* private fields */ }
Expand description
Maps a function over the output of a rule. See Rule::map_parsed
.
Trait Implementations§
source§impl<'input, SliceType: Clone + ?Sized, R: Clone + Rule<'input, SliceType>, O: Clone, Func: Clone + Fn(R::Output) -> O> Clone for Map<'input, SliceType, R, O, Func>
impl<'input, SliceType: Clone + ?Sized, R: Clone + Rule<'input, SliceType>, O: Clone, Func: Clone + Fn(R::Output) -> O> Clone for Map<'input, SliceType, R, O, Func>
source§impl<'input, SliceType: Debug + ?Sized, R: Debug + Rule<'input, SliceType>, O: Debug, Func: Debug + Fn(R::Output) -> O> Debug for Map<'input, SliceType, R, O, Func>
impl<'input, SliceType: Debug + ?Sized, R: Debug + Rule<'input, SliceType>, O: Debug, Func: Debug + Fn(R::Output) -> O> Debug for Map<'input, SliceType, R, O, Func>
source§impl<'input, SliceType: ?Sized, R: Rule<'input, SliceType>, O, Func: Fn(R::Output) -> O> NamedRule for Map<'input, SliceType, R, O, Func>
impl<'input, SliceType: ?Sized, R: Rule<'input, SliceType>, O, Func: Fn(R::Output) -> O> NamedRule for Map<'input, SliceType, R, O, Func>
source§impl<'input, SliceType: PartialEq + ?Sized, R: PartialEq + Rule<'input, SliceType>, O: PartialEq, Func: PartialEq + Fn(R::Output) -> O> PartialEq for Map<'input, SliceType, R, O, Func>
impl<'input, SliceType: PartialEq + ?Sized, R: PartialEq + Rule<'input, SliceType>, O: PartialEq, Func: PartialEq + Fn(R::Output) -> O> PartialEq for Map<'input, SliceType, R, O, Func>
source§impl<'input, SliceType: ?Sized, R: Rule<'input, SliceType>, O, Func: Fn(R::Output) -> O> Rule<'input, SliceType> for Map<'input, SliceType, R, O, Func>
impl<'input, SliceType: ?Sized, R: Rule<'input, SliceType>, O, Func: Fn(R::Output) -> O> Rule<'input, SliceType> for Map<'input, SliceType, R, O, Func>
source§type Output = <Func as FnOnce(<R as Rule<'input, SliceType>>::Output)>::Output
type Output = <Func as FnOnce(<R as Rule<'input, SliceType>>::Output)>::Output
The type of the value of a successful parse of this rule.
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, Func: Fn(R::Output) -> O> StructuralPartialEq for Map<'input, SliceType, R, O, Func>
Auto Trait Implementations§
impl<'input, SliceType, R, O, Func> Freeze for Map<'input, SliceType, R, O, Func>
impl<'input, SliceType, R, O, Func> RefUnwindSafe for Map<'input, SliceType, R, O, Func>
impl<'input, SliceType, R, O, Func> Send for Map<'input, SliceType, R, O, Func>
impl<'input, SliceType, R, O, Func> Sync for Map<'input, SliceType, R, O, Func>
impl<'input, SliceType, R, O, Func> Unpin for Map<'input, SliceType, R, O, Func>
impl<'input, SliceType, R, O, Func> UnwindSafe for Map<'input, SliceType, R, O, 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
)