Skip to main content

Crate monch

Crate monch 

Source

Structs§

ParseErrorFailure
A complete parsing failure along with the location the error occurred and the error message.
ParseErrorFailureError

Enums§

ParseError
An error that occurred while parsing.

Traits§

IsEmptyable

Functions§

assert
Asserts that a given condition is true about the combinator. Otherwise returns an error with the message.
assert_exists
Asserts that a combinator resolves. If backtracing occurs, returns a failure.
ch
Recognizes a character.
check_not
Checks if a combinator is false without consuming the input.
delimited
Gets a second value that is delimited by a first and third.
if_not_empty
Checks if the combinator result is not empty.
if_true
Checks if a condition is true for a combinator.
log_result
Logs the result for quick debugging purposes.
many0
Applies the combinator 0 or more times and returns a vector of all the parsed results.
many0_count
Counts how many times the combinator matches before a backtrace. Equivalent to many0(...).len() but does not allocate.
many1
Applies the combinator at least 1 time, but maybe more and returns a vector of all the parsed results.
many_till
Keeps consuming a combinator into an array until a condition is met or backtracing occurs.
many_till_fold
Like many_till but folds each parsed item into an accumulator instead of allocating a Vec. Use this when you only need a derived value (e.g. a count, a sum, or a custom collection).
map
Maps the success of a combinator by a function.
map_res
Maps the result of a combinator by a function.
maybe
Maps a success to Some(T) and a backtrace to None.
next_char
Gets the next character.
one_of
Recognizes any character in the provided string.
or
Checks for either to match.
or3
Checks for any to match.
or4
Checks for any to match.
or5
Checks for any to match.
or6
Checks for any to match.
or7
Checks for any to match.
pair
Returns both results of the two combinators.
preceded
Returns the second value and discards the first.
separated_count
Counts how many separated items the combinator matches. Equivalent to separated_list(...).len() but does not allocate.
separated_fold
Like separated_list but folds each parsed item into an accumulator instead of allocating a Vec.
separated_list
Keeps consuming a combinator into an array until a condition is met or backtracing occurs.
skip_while
Skip the input while the condition is true.
skip_while_byte
Skip the input while the condition is true on each byte. Faster than skip_while when the predicate is ASCII-only — a byte loop avoids UTF-8 decoding. The predicate must return false for any non-ASCII continuation byte for input slicing to land on a char boundary; in practice this is satisfied automatically by ASCII-classifier predicates like is_ascii_digit / is_ascii_alphanumeric / == b' '.
skip_whitespace
Skips the whitespace.
substring
Gets the substring found for the duration of the combinator.
tag
Recognizes a string.
tag_owned
Recognizes a runtime-built string.
take_while
Takes a substring while the condition is true.
take_while_byte
Byte-based variant of take_while; see skip_while_byte for the constraint on cond.
terminated
Returns the first value and discards the second.
whitespace
Parses and expects whitespace.
with_error_context
Provides some context to a failure.
with_failure_handling
Opinionated helper that converts a combinator into a Result<T, String>
with_failure_input
Changes the input on a failure in order to provide a better error message.

Type Aliases§

ParseResult