Expand description
Zero-copy isomorphic parsing: your code should look like what it parses.
§Examples
Want to parse something in parentheses? Surround it in parentheses:
use transduce::base::*;
let parser = exact(&b'(') >> anything() << exact(&b')') << end();
let input = b"(*)";
assert_eq!(
parser.parse(input),
Ok(&b'*'), // Reference to the region of input inside parentheses
);
Modules§
- base
- Common functions to drop in instead of reinventing the wheel.
- print_
error - Trait for pretty-printing parse errors.
Macros§
- bail
- Immediately return with an error. The second argument requests the slice of input after this error, so we can deduce where it happened.
- format_
if_ alloc - Heap-allocated custom formatting if
alloc
is enabled; otherwise, use the first, non-heap argument.
Structs§
- Both
- Perform two actions in order and return both of their results as a tuple.
- Discard
Left - Perform two actions in order and discard the result of the first, returning the result of the second.
- Discard
Right - Perform two actions in order and discard the result of the second, returning the result of the first.
- Either
- Perform two actions in order and return the first one to succeed, or the second error if neither succeed.
- Parse
Error - Parsing error: both a message and where it was, via accepting the length of input after the error.
- Parser
- Wrapper around a parser to work with the orphan rule.
- Pipe
- Perform a parsing action then pipe its output into a non-parsing function.