Skip to main content

PrattParserMap

Struct PrattParserMap 

Source
pub struct PrattParserMap<'pratt, 'a, 'i, R, F, T, P = PrattParser<R>>
where R: RuleType, F: FnMut(Pair<'i, R>) -> T, P: PrattParserOps<R>,
{ /* private fields */ }
Expand description

Product of calling map_primary on a PrattParser or ConstPrattParser, defines how expressions should be mapped.

Implementations§

Source§

impl<'pratt, 'a, 'i, R, F, T, P> PrattParserMap<'pratt, 'a, 'i, R, F, T, P>
where R: RuleType + 'pratt, F: FnMut(Pair<'i, R>) -> T, P: PrattParserOps<R> + 'pratt,

Source

pub fn map_prefix<X>(self, prefix: X) -> Self
where X: FnMut(Pair<'i, R>, T) -> T + 'a,

Maps prefix operators with closure prefix.

Source

pub fn map_postfix<X>(self, postfix: X) -> Self
where X: FnMut(T, Pair<'i, R>) -> T + 'a,

Maps postfix operators with closure postfix.

Source

pub fn map_infix<X>(self, infix: X) -> Self
where X: FnMut(T, Pair<'i, R>, T) -> T + 'a,

Maps infix operators with a closure infix.

Source

pub fn parse<I: Iterator<Item = Pair<'i, R>>>(&mut self, pairs: I) -> T

The last method to call on the provided pairs to execute the Pratt parser (previously defined using map_primary, map_prefix, map_postfix, and map_infix methods).

§Panics

Panics if the input pairs contain a prefix operator with no map_prefix, an infix operator with no map_infix, a postfix operator with no map_postfix, or an unexpected token that is not a valid prefix, primary, infix, or postfix expression.

Auto Trait Implementations§

§

impl<'pratt, 'a, 'i, R, F, T, P = PrattParser<R>> !RefUnwindSafe for PrattParserMap<'pratt, 'a, 'i, R, F, T, P>

§

impl<'pratt, 'a, 'i, R, F, T, P = PrattParser<R>> !Send for PrattParserMap<'pratt, 'a, 'i, R, F, T, P>

§

impl<'pratt, 'a, 'i, R, F, T, P = PrattParser<R>> !Sync for PrattParserMap<'pratt, 'a, 'i, R, F, T, P>

§

impl<'pratt, 'a, 'i, R, F, T, P = PrattParser<R>> !UnwindSafe for PrattParserMap<'pratt, 'a, 'i, R, F, T, P>

§

impl<'pratt, 'a, 'i, R, F, T, P> Freeze for PrattParserMap<'pratt, 'a, 'i, R, F, T, P>
where &'pratt P: Freeze, F: Freeze, Option<Box<dyn FnMut(Pair<'i, R>, T) -> T + 'a>>: Freeze, Option<Box<dyn FnMut(T, Pair<'i, R>) -> T + 'a>>: Freeze, Option<Box<dyn FnMut(T, Pair<'i, R>, T) -> T + 'a>>: Freeze, PhantomData<T>: Freeze,

§

impl<'pratt, 'a, 'i, R, F, T, P> Unpin for PrattParserMap<'pratt, 'a, 'i, R, F, T, P>
where &'pratt P: Unpin, F: Unpin, Option<Box<dyn FnMut(Pair<'i, R>, T) -> T + 'a>>: Unpin, Option<Box<dyn FnMut(T, Pair<'i, R>) -> T + 'a>>: Unpin, Option<Box<dyn FnMut(T, Pair<'i, R>, T) -> T + 'a>>: Unpin, PhantomData<T>: Unpin,

§

impl<'pratt, 'a, 'i, R, F, T, P> UnsafeUnpin for PrattParserMap<'pratt, 'a, 'i, R, F, T, P>
where &'pratt P: UnsafeUnpin, F: UnsafeUnpin, Option<Box<dyn FnMut(Pair<'i, R>, T) -> T + 'a>>: UnsafeUnpin, Option<Box<dyn FnMut(T, Pair<'i, R>) -> T + 'a>>: UnsafeUnpin, Option<Box<dyn FnMut(T, Pair<'i, R>, T) -> T + 'a>>: UnsafeUnpin, PhantomData<T>: UnsafeUnpin,

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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.