• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rust-bakery / nom / 5231977364

Canceled at 11 Jul 2024 04:52AM UTC via web
5231977364

push

github

web-flow
Add an OutputMode type parameter to drive parser results (#1631)

* add initial traits for GAT integration

The Mode trait will be used to adapt the production of output or error
values depending on the call site. If we do not care about the actual
value or error, and just want to know if a parser was succssful or not,
then the Mode trait allows us to signal it without producng the actual
type.

in Err, the Error and Failure variants get different types, because
usually want to get the failure variant, while the error variant might
change independently.

The OutputMode trait also carries information about the streaming or
complete status, and in the same way define which type of parser we
want, directly at the call site

* convert the Parser trait

a new `process` method is used to handle the new OutputMode trait.
The `OutputM` supporting structure is used to carry which modes we want
to use, and depending on the case, we can call an inner parser using
directly the mode we're in (example: Map), or we can convert it to Emit
for Output (ex: MapRes because we have to apply the mapping function on
the parser output and check for errors).

We keep the `parse` method with `Emit` for both output and error, which
allows us to convert combinators gradually: the ones using `parse` will
work but won't benefit directly from these traits also parent and child
combinators in a serie of parsers may support it

* various optimizations

it turns out that rustc is generating separate functions for each
process() implementation, which tends to slow things down

* raise minimal version to 1.65

1177 of 1177 new or added lines in 19 files covered. (100.0%)

1812 of 2916 relevant lines covered (62.14%)

5.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

60.14
/src/combinator/mod.rs


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc