pub struct Delimited<P, D, O2> { /* private fields */ }
Expand description

Parser which gets and discards a delimiting value both before and after the main subparser. Returns the output from the main subparser if all were successful.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

A parser takes in input type, and returns a Result containing either the remaining input and the output value, or an error Read more

Maps a function over the result of a parser

Creates a second parser from the output of the first one, then apply over the rest of the input

Applies a second parser over the output of the first one

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

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

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Given the context attached to a nom error, and given the original input to the nom parser, extract more the useful context information. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Borrow a parser. This allows building parser combinators while still retaining ownership of the original parser. This is necessary because impl<T: Parser> Parser for &mut T is impossible due to conflicts with impl<T: FnMut> Parser for T. Read more

Create a parser that must consume all of the input, or else return an error. Read more

Create a parser that transforms Incomplete into Error. Read more

Create a parser that transforms Error into Failure. This will end the parse immediately, even if there are other branches that could occur. Read more

Create a parser that applies a mapping function func to the output of the subparser. Any errors from func will be transformed into parse errors via FromExternalError. Read more

Create a parser that applies a mapping function func to the output of the subparser. Any errors from func will be transformed into parse failures via FromExternalError. This will end the parse immediately, even if there are other branches that could occur. Read more

Make this parser optional; if it fails to parse, instead it returns None with the input in the original position. Read more

Replace this parser’s output with the entire input that was consumed by the parser. Read more

Return the parsed value, but also return the entire input that was consumed by the parse Read more

Replace this parser’s output with a clone of value every time it finishes successfully. Read more

Require the output of this parser to pass a verifier function, or else return a parse error. Read more

Add some context to the parser. This context will be added to any errors that are returned from the parser via ContextError. Read more

Add a terminator parser. The terminator will run after this parser, returning any errors, but its output will otherwise be discarded. Read more

Make this parser precede another one. The successor parser will run after this one succeeds, and the successor’s output will be returned. Read more

Make this parser preceded by another one. The prefix will run first, and if it succeeds, its output will be discard and this parser will be run. Read more

Make this parser optionally precede by another one. self will run first, and then the successor will run even if self returns an error. Both outputs will be returned. This is functionally equivalent to self.opt().and(successor), but it has the added benefit that if both parsers return an error, the error from the prefix will be retained, rather than discarded. Read more

Make this parser optionally preceded by another one. The prefix will run first, and then this parser will run even if the prefix returned an error. Both outputs will be returned. This is functionally equivalent to prefix.opt().and(self), but it has the added benefit that if both parsers return an error, the error from the prefix will be retained, rather than discarded. Read more

Make this parser delimited, requiring a delimiter as both a prefix and a suffix. The output of the delimiters is discarded. Read more

Make this parser peeking: it runs normally but consumes no input. Read more

Make this parser a negative lookahead: it will succeed if the subparser fails, and fail if the subparser succeeds. Read more

Create a parser that parses something via FromStr, using this parser as a recognizer for the string to pass to from_str. Read more

Create a parser that parses something via FromStr, using this parser as a recognizer for the string to pass to from_str. This parser transforms any errors from FromStr into Err::Failure, which will end the overall parse immediately, even if there are other branches that could be tried. Read more

Create a parser that parses a fixed-size array by running this parser in a loop. Read more

Create a parser that parses a fixed-size array by running this parser in a loop, parsing a separator in between each element. Read more

Given the original input, as well as the context reported by nom, recreate a context in the original string where the error occurred. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.