mirror of
https://github.com/rust-bakery/nom.git
synced 2026-03-28 06:40:42 +00:00
* 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