Trait rusty_parser::IntoParser
source · pub trait IntoParser {
type Into;
Show 17 methods
// Required method
fn into_parser(self) -> Self::Into;
// Provided methods
fn seq<RhsParser: IntoParser>(
self,
rhs: RhsParser
) -> SeqParser<Self::Into, RhsParser::Into>
where Self: Sized { ... }
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> { ... }
fn or<RhsParser: IntoParser>(
self,
rhs: RhsParser
) -> OrParser<Self::Into, RhsParser::Into>
where Self: Sized { ... }
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 { ... }
fn void_(self) -> VoidParser<Self::Into>
where Self: Sized { ... }
fn optional(self) -> OptionalParser<Self::Into>
where Self: Sized { ... }
fn optional_or<Output: Clone + Tuple>(
self,
output: Output
) -> OptionalOrParser<Self::Into, Output>
where Self: Sized { ... }
fn refcell(self) -> RefCelledParser<Self::Into>
where Self: Sized { ... }
fn rc(self) -> RcedParser<Self::Into>
where Self: Sized { ... }
fn box_chars<Output>(self) -> DynBoxChars<Output>
where Output: Tuple,
Self: Sized,
Self::Into: for<'a> Parser<Chars<'a>, Output = Output> + 'static { ... }
fn box_slice<Output, T>(self) -> DynBoxSlice<Output, T>
where Output: Tuple,
Self: Sized,
Self::Into: for<'a> Parser<Iter<'a, T>, Output = Output> + 'static { ... }
fn not<RhsParser: IntoParser>(
self,
rhs: RhsParser
) -> NotParser<Self::Into, RhsParser::Into>
where Self: Sized { ... }
fn output<Output: Tuple + Clone>(
self,
output: Output
) -> OutputParser<Self::Into, Output>
where Self: Sized { ... }
fn string(self) -> StringParser<Self::Into>
where Self: Sized,
Self::Into: for<'a> Parser<Chars<'a>> { ... }
fn vec<T>(self) -> SliceParser<Self::Into>
where Self: Sized,
Self::Into: for<'a> Parser<Iter<'a, T>> { ... }
fn not_consume(self) -> NotConsumeParser<Self::Into>
where Self: Sized { ... }
}Expand description
Trait for converting possible types to Parser
Required Associated Types§
Required Methods§
fn into_parser(self) -> Self::Into
Provided Methods§
sourcefn seq<RhsParser: IntoParser>(
self,
rhs: RhsParser
) -> SeqParser<Self::Into, RhsParser::Into>where
Self: Sized,
fn seq<RhsParser: IntoParser>(
self,
rhs: RhsParser
) -> SeqParser<Self::Into, RhsParser::Into>where
Self: Sized,
concatenate two parser
sourcefn 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>,
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 for given range ( this matches as long as possible )
sourcefn or<RhsParser: IntoParser>(
self,
rhs: RhsParser
) -> OrParser<Self::Into, RhsParser::Into>where
Self: Sized,
fn or<RhsParser: IntoParser>(
self,
rhs: RhsParser
) -> OrParser<Self::Into, RhsParser::Into>where
Self: Sized,
Or combinator of parsers
sourcefn map<ClosureType, ClosureInput, ClosureOutput>(
self,
callback: ClosureType
) -> MapParser<Self::Into, ClosureType, ClosureInput, ClosureOutput>
fn map<ClosureType, ClosureInput, ClosureOutput>( self, callback: ClosureType ) -> MapParser<Self::Into, ClosureType, ClosureInput, ClosureOutput>
Map parser’s Output to new value
sourcefn void_(self) -> VoidParser<Self::Into>where
Self: Sized,
fn void_(self) -> VoidParser<Self::Into>where
Self: Sized,
change Parser’s Output to (). This internally call match_pattern() instead of parse()
sourcefn optional(self) -> OptionalParser<Self::Into>where
Self: Sized,
fn optional(self) -> OptionalParser<Self::Into>where
Self: Sized,
this parser always success whether the input is matched or not
fn optional_or<Output: Clone + Tuple>(
self,
output: Output
) -> OptionalOrParser<Self::Into, Output>where
Self: Sized,
sourcefn refcell(self) -> RefCelledParser<Self::Into>where
Self: Sized,
fn refcell(self) -> RefCelledParser<Self::Into>where
Self: Sized,
create RefCell<Parser> wrapper
sourcefn rc(self) -> RcedParser<Self::Into>where
Self: Sized,
fn rc(self) -> RcedParser<Self::Into>where
Self: Sized,
create Rc<Parser> wrapper
sourcefn box_chars<Output>(self) -> DynBoxChars<Output>
fn box_chars<Output>(self) -> DynBoxChars<Output>
create a Box<dyn Parser> wrapper for iterators of std::str::Chars
This can take any parser with Output of Output
sourcefn box_slice<Output, T>(self) -> DynBoxSlice<Output, T>
fn box_slice<Output, T>(self) -> DynBoxSlice<Output, T>
create a Box<dyn Parser> wrapper for iterators of std::slice::Iter
This can take any parser with Output of Output
sourcefn not<RhsParser: IntoParser>(
self,
rhs: RhsParser
) -> NotParser<Self::Into, RhsParser::Into>where
Self: Sized,
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
This is equivalent to not(parser1, parser2)
sourcefn output<Output: Tuple + Clone>(
self,
output: Output
) -> OutputParser<Self::Into, Output>where
Self: Sized,
fn output<Output: Tuple + Clone>(
self,
output: Output
) -> OutputParser<Self::Into, Output>where
Self: Sized,
change Parser’s Output to output
sourcefn string(self) -> StringParser<Self::Into>
fn string(self) -> StringParser<Self::Into>
returns String of parsed input only works for parsing with std::str::Chars
sourcefn vec<T>(self) -> SliceParser<Self::Into>
fn vec<T>(self) -> SliceParser<Self::Into>
returns Vec
sourcefn not_consume(self) -> NotConsumeParser<Self::Into>where
Self: Sized,
fn not_consume(self) -> NotConsumeParser<Self::Into>where
Self: Sized,
Parser will not consume the input iterator It still match and return the output