Crate winnow
winnow, making parsing a breeze
winnow is a parser combinator library
Quick links:
- [List of combinators][crate::combinator]
- [Tutorial][_tutorial::chapter_0]
- [Special Topics][_topic]
- Discussions
- CHANGELOG (includes major version migration guides)
Aspirations
winnow aims to be your "do everything" parser, much like people treat regular expressions.
In roughly priority order:
- Support writing parser declaratively while not getting in the way of imperative-style parsing when needed, working as an open-ended toolbox rather than a close-ended framework.
- Flexible enough to be used for any application, including parsing strings, binary data, or separate [lexing and parsing phases][_topic::lexing]
- Zero-cost abstractions, making it easy to write high performance parsers
- Easy to use, making it trivial for one-off uses
In addition:
- Resilient maintainership, including
- Willing to break compatibility rather than batching up breaking changes in large releases
- Leverage feature flags to keep one active branch
- We will support the last 6 months of rust releases (MSRV, currently 1.64.0)
See also [Special Topic: Why winnow?][crate::_topic::why]
Example
Run
$ cargo add winnow
Then use it to parse:
#
See also the [Tutorial][_tutorial::chapter_0] and [Special Topics][_topic]
Modules
Structs
-
BStr
Improved
Debugexperience for&[u8]UTF-8-ish streams -
Bytes
Improved
Debugexperience for&[u8]byte streams - LocatingSlice Allow collecting the span of a parsed token within a slice
- Partial Mark the input as a partial buffer for streaming input.
- Stateful Thread global state through your parsers
Type Aliases
-
ModalResult
[Modal error reporting][ErrMode] for
Parser::parse_next -
Result
By default, the error type (
E) isContextError. - Str UTF-8 Stream