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,

source§

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 error
source§

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,

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,

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,

Applies a second parser after the first one, return their results as a tuple
source§

fn or<G>(self, g: G) -> Or<Self, G>where G: Parser<I, O, E>, Self: Sized,

Applies a second parser over the input if the first one failed
source§

fn into<O2, E2>(self) -> Into<Self, O, O2, E, E2>where O2: From<O>, E2: From<E>, Self: Sized,

automatically converts the parser’s output and error values to another type, as long as they implement the From trait

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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, 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>,

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

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,

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

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

Convert the output with the FromStr trait.
source§

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

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

Converts nom::Err::Incomplete to a error code.
source§

fn cut(self) -> Cut<T>

Convert from nom::Err::Error to nom::Err::Failure
source§

fn opt(self) -> Optional<T>

Optional parser.
source§

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,

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

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

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,

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

Runs the delimiter before and after the main parser, and returns just the result of the main parser.
source§

fn peek(self) -> Peek<T>where I: Clone,

Runs the parser but doesn’t change the input.
source§

fn not<C>(self, code: C) -> PNot<T, C, O>

Fails if the parser succeeds and vice versa.
source§

fn or_else<PE, OE>(self, other: PE) -> OrElse<T, PE, OE>where PE: Parser<I, OE, E>,

Or. Returns a (Option<A>, Option<B>)
source§

fn verify<V, C, O2>(self, verify: V, code: C) -> Verify<T, V, C, O2>where C: Code, V: Fn(&O2) -> bool, O: Borrow<O2>, E: KParseError<C, I>, O2: ?Sized,

Runs a verify function on the parser result.
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.