Struct rusty_parser::DynBoxChars

source ·
pub struct DynBoxChars<Output>
where Output: Tuple,
{ /* private fields */ }
Expand description

A Box<dyn Parser> wrapper for iterators of std::str::Chars.

This can take any parser with Output of Output.

Once you wrap the parser with this, you can only use input iterator of std::str::Chars.

Implementations§

source§

impl<Output> DynBoxChars<Output>
where Output: Tuple,

source

pub fn new<ParserType: IntoParser>(parser: ParserType) -> Self
where ParserType::Into: for<'a> Parser<Chars<'a>, Output = Output> + 'static,

source

pub fn assign<ParserType: IntoParser>(&mut self, parser: ParserType)
where ParserType::Into: for<'a> Parser<Chars<'a>, Output = Output> + 'static,

Trait Implementations§

source§

impl<Output> Deref for DynBoxChars<Output>
where Output: Tuple,

§

type Target = Box<dyn for<'a> Parser<Chars<'a>, Output = Output>>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<Output> DerefMut for DynBoxChars<Output>
where Output: Tuple,

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<Output> IntoParser for DynBoxChars<Output>
where Output: Tuple,

§

type Into = DynBoxChars<Output>

Target Parser type
source§

fn into_parser(self) -> Self::Into

convert self to Parser Read more
source§

fn seq<RhsParser: IntoParser>( self, rhs: RhsParser ) -> SeqParser<Self::Into, RhsParser::Into>
where Self: Sized,

concatenate two parser Read more
source§

fn repeat<Idx, RangeType>( self, range_: RangeType ) -> RepeatParser<Self::Into, RangeType, Idx>
where Self: Sized, RangeType: RangeBounds<Idx>, Idx: PartialOrd + PartialEq + PartialOrd<i32> + PartialEq<i32>, i32: PartialOrd + PartialEq + PartialOrd<Idx> + PartialEq<Idx>,

repeat parser multiple times. This tries to match as long as possible. Read more
source§

fn or<RhsParser: IntoParser>( self, rhs: RhsParser ) -> OrParser<Self::Into, RhsParser::Into>
where Self: Sized,

or combinator for two parsers Read more
source§

fn map<ClosureType, ClosureInput, ClosureOutput>( self, callback: ClosureType ) -> MapParser<Self::Into, ClosureType, ClosureInput, ClosureOutput>
where ClosureInput: Tuple, ClosureType: Fn(ClosureInput) -> ClosureOutput, ClosureOutput: Tuple, Self: Sized,

Map parser’s Output to new value Read more
source§

fn void(self) -> VoidParser<Self::Into>
where Self: Sized,

Change Parser’s Output to (). This internally call match_pattern() instead of parse() Read more
source§

fn optional(self) -> OptionalParser<Self::Into>
where Self: Sized,

This parser always success whether the input is matched or not. Read more
source§

fn optional_or<Output: Clone + Tuple>( self, output: Output ) -> OptionalOrParser<Self::Into, Output>
where Self: Sized,

This parser always success whether the input is matched or not. Read more
source§

fn refcell(self) -> RefCelledParser<Self::Into>
where Self: Sized,

create RefCell<Parser> wrapper. Read more
source§

fn rc(self) -> RcedParser<Self::Into>
where Self: Sized,

Create Rc<Parser> wrapper. Read more
source§

fn box_slice<Output, T>(self) -> DynBoxSlice<Output, T>
where Output: Tuple, T: Clone + Copy, Self: Sized, Self::Into: for<'a> Parser<Copied<Iter<'a, T>>, Output = Output> + 'static,

create a Box<dyn Parser> wrapper for iterators of std::iter::Copied<std::slice::Iter>. Read more
source§

fn not<RhsParser: IntoParser>( self, rhs: RhsParser ) -> NotParser<Self::Into, RhsParser::Into>
where Self: Sized,

Match for parser1 parser2, parser1 must success and parser2 must fail. Read more
source§

fn output<Output: Tuple + Clone>( self, output: Output ) -> OutputParser<Self::Into, Output>
where Self: Sized,

Change Parser’s Output to output. Read more
source§

fn vec<T>(self) -> SliceParser<Self::Into>
where Self: Sized, Self::Into: for<'a> Parser<Copied<Iter<'a, T>>>,

Returns Vec\<T\> of parsed input. Only works for parsing with std::iter::Copied<std::slice::Iter>. Read more
source§

fn not_consume(self) -> NotConsumeParser<Self::Into>
where Self: Sized,

Parser will not consume the input iterator. It still match and return the output. Read more
source§

impl<'a, Output> Parser<Chars<'a>> for DynBoxChars<Output>
where Output: Tuple,

§

type Output = Output

source§

fn parse(&self, it: Chars<'a>) -> ParseResult<Self::Output, Chars<'a>>

source§

fn match_pattern(&self, it: Chars<'a>) -> ParseResult<(), Chars<'a>>

Auto Trait Implementations§

§

impl<Output> Freeze for DynBoxChars<Output>

§

impl<Output> !RefUnwindSafe for DynBoxChars<Output>

§

impl<Output> !Send for DynBoxChars<Output>

§

impl<Output> !Sync for DynBoxChars<Output>

§

impl<Output> Unpin for DynBoxChars<Output>

§

impl<Output> !UnwindSafe for DynBoxChars<Output>

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>,

§

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>,

§

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.