Struct OpParser

Source
pub struct OpParser<'a, OperatorEnum>
where OperatorEnum: Sized + Copy + Debug,
{ /* private fields */ }
Expand description

Operator parser state Is generic over the Atom return type and the Operator type (Usually an enum)

Implementations§

Source§

impl<'a, OpEnum> OpParser<'a, OpEnum>
where OpEnum: PartialEq + Copy + Debug,

Source

pub fn new(ap: Box<dyn Fn(&[u8]) -> IResult<&[u8], &[u8]>>) -> Self

Creates a new Operator parser

Source

pub fn add(&mut self, op: Operator<OpEnum>)

Adds a new operator to the list

Source

pub fn parse<'b: 'a>( &mut self, input: &'b [u8], ) -> IResult<&'b [u8], &Expr<&[u8], OpEnum>>

Parses a slice of bytes

Auto Trait Implementations§

§

impl<'a, OperatorEnum> Freeze for OpParser<'a, OperatorEnum>

§

impl<'a, OperatorEnum> !RefUnwindSafe for OpParser<'a, OperatorEnum>

§

impl<'a, OperatorEnum> !Send for OpParser<'a, OperatorEnum>

§

impl<'a, OperatorEnum> !Sync for OpParser<'a, OperatorEnum>

§

impl<'a, OperatorEnum> Unpin for OpParser<'a, OperatorEnum>
where OperatorEnum: Unpin,

§

impl<'a, OperatorEnum> !UnwindSafe for OpParser<'a, OperatorEnum>

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 = Infallible

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.