Struct kparse::parser_ext::Complete
source · pub struct Complete<PA, C> { /* private fields */ }Expand description
Converts nom::Err::Incomplete to a error code.
Trait Implementations§
source§impl<PA, C, I, O, E> Parser<I, O, E> for Complete<PA, C>where
PA: Parser<I, O, E>,
C: Code,
E: KParseError<C, I>,
I: Clone,
impl<PA, C, I, O, E> Parser<I, O, E> for Complete<PA, C>where PA: Parser<I, O, E>, C: Code, E: KParseError<C, I>, I: Clone,
source§fn parse(&mut self, input: I) -> IResult<I, O, E>
fn parse(&mut self, input: I) -> IResult<I, O, E>
A parser takes in input type, and returns a
Result containing
either the remaining input and the output value, or an errorsource§fn map<G, O2>(self, g: G) -> Map<Self, G, O>where
G: Fn(O) -> O2,
Self: Sized,
fn map<G, O2>(self, g: G) -> Map<Self, G, O>where G: Fn(O) -> O2, Self: Sized,
Maps a function over the result of a parser
source§fn flat_map<G, H, O2>(self, g: G) -> FlatMap<Self, G, O>where
G: FnMut(O) -> H,
H: Parser<I, O2, E>,
Self: Sized,
fn flat_map<G, H, O2>(self, g: G) -> FlatMap<Self, G, O>where G: FnMut(O) -> H, H: Parser<I, O2, E>, Self: Sized,
Creates a second parser from the output of the first one, then apply over the rest of the input
source§fn and_then<G, O2>(self, g: G) -> AndThen<Self, G, O>where
G: Parser<O, O2, E>,
Self: Sized,
fn and_then<G, O2>(self, g: G) -> AndThen<Self, G, O>where G: Parser<O, O2, E>, Self: Sized,
Applies a second parser over the output of the first one
source§fn and<G, O2>(self, g: G) -> And<Self, G>where
G: Parser<I, O2, E>,
Self: Sized,
fn and<G, O2>(self, g: G) -> And<Self, G>where G: Parser<I, O2, E>, Self: Sized,
Applies a second parser after the first one, return their results as a tuple
Auto Trait Implementations§
impl<PA, C> RefUnwindSafe for Complete<PA, C>where C: RefUnwindSafe, PA: RefUnwindSafe,
impl<PA, C> Send for Complete<PA, C>where C: Send, PA: Send,
impl<PA, C> Sync for Complete<PA, C>where C: Sync, PA: Sync,
impl<PA, C> Unpin for Complete<PA, C>where C: Unpin, PA: Unpin,
impl<PA, C> UnwindSafe for Complete<PA, C>where C: UnwindSafe, PA: UnwindSafe,
Blanket Implementations§
source§impl<T, I, O, E> KParser<I, O, E> for Twhere
T: Parser<I, O, E>,
impl<T, I, O, E> KParser<I, O, E> for Twhere T: Parser<I, O, E>,
source§fn err_into<E2>(self) -> IntoErr<T, O, E, E2>where
E: Into<E2>,
fn err_into<E2>(self) -> IntoErr<T, O, E, E2>where E: Into<E2>,
Converts the error to the target error.
source§fn with_code<C>(self, code: C) -> WithCode<T, C>where
C: Code,
E: KParseError<C, I>,
fn with_code<C>(self, code: C) -> WithCode<T, C>where C: Code, E: KParseError<C, I>,
Changes the error code.
source§fn with_context<C, Y>(self, context: Y) -> WithContext<T, C, E, Y>where
C: Code,
I: Clone,
E: Into<ParserError<C, I>>,
Y: Clone + 'static,
fn with_context<C, Y>(self, context: Y) -> WithContext<T, C, E, Y>where C: Code, I: Clone, E: Into<ParserError<C, I>>, Y: Clone + 'static,
Adds some context.
source§fn map_res<TR, O2>(self, map: TR) -> MapRes<T, O, TR, O2>where
TR: Fn(O) -> Result<O2, Err<E>>,
fn map_res<TR, O2>(self, map: TR) -> MapRes<T, O, TR, O2>where TR: Fn(O) -> Result<O2, Err<E>>,
Map the output.
source§fn parse_from_str<C, O2>(self, code: C) -> FromStrParser<T, C, O, O2>where
C: Code,
O: InputIter<Item = char>,
O2: FromStr,
E: KParseError<C, I>,
fn parse_from_str<C, O2>(self, code: C) -> FromStrParser<T, C, O, O2>where C: Code, O: InputIter<Item = char>, O2: FromStr, E: KParseError<C, I>,
Convert the output with the FromStr trait.
source§fn value<O2>(self, value: O2) -> Value<T, O, O2>where
O2: Clone,
fn value<O2>(self, value: O2) -> Value<T, O, O2>where O2: Clone,
Replace the output with the value.
source§fn all_consuming<C>(self, code: C) -> AllConsuming<T, C>where
C: Code,
I: InputLength,
E: KParseError<C, I>,
fn all_consuming<C>(self, code: C) -> AllConsuming<T, C>where C: Code, I: InputLength, E: KParseError<C, I>,
Fails if not everything has been processed.
source§fn complete<C>(self, code: C) -> Complete<T, C>where
C: Code,
I: Clone,
E: KParseError<C, I>,
fn complete<C>(self, code: C) -> Complete<T, C>where C: Code, I: Clone, E: KParseError<C, I>,
Converts nom::Err::Incomplete to a error code.
source§fn recognize(self) -> Recognize<T, O>where
I: Clone + Slice<RangeTo<usize>> + Offset,
fn recognize(self) -> Recognize<T, O>where I: Clone + Slice<RangeTo<usize>> + Offset,
Run the parser and return the parsed input.
source§fn consumed(self) -> Consumed<T>where
I: Clone + Slice<RangeTo<usize>> + Offset,
fn consumed(self) -> Consumed<T>where I: Clone + Slice<RangeTo<usize>> + Offset,
Run the parser and return the parser output and the parsed input.
source§fn terminated<PA, O2>(self, terminator: PA) -> Terminated<T, PA, O2>where
PA: Parser<I, O2, E>,
fn terminated<PA, O2>(self, terminator: PA) -> Terminated<T, PA, O2>where PA: Parser<I, O2, E>,
Runs the parser and the terminator and just returns the result of the parser.
source§fn precedes<PS, O2>(self, successor: PS) -> Precedes<T, PS, O>where
PS: Parser<I, O2, E>,
fn precedes<PS, O2>(self, successor: PS) -> Precedes<T, PS, O>where PS: Parser<I, O2, E>,
Runs the parser and the successor and only returns the result of the
successor.
source§fn opt_precedes<PS, O2>(self, successor: PS) -> OptPrecedes<T, PS, O>where
PS: Parser<I, O2, E>,
I: Clone,
fn opt_precedes<PS, O2>(self, successor: PS) -> OptPrecedes<T, PS, O>where PS: Parser<I, O2, E>, I: Clone,
Runs the parser and the successor and returns the result of the successor.
The parser itself may fail too.
source§fn delimited_by<PA, O2>(self, delimiter: PA) -> DelimitedBy<T, PA, O2>where
PA: Parser<I, O2, E>,
fn delimited_by<PA, O2>(self, delimiter: PA) -> DelimitedBy<T, PA, O2>where PA: Parser<I, O2, E>,
Runs the delimiter before and after the main parser, and returns just
the result of the main parser.