trivet 3.1.0

The trivet Parser Library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Just a test of the buffering in the parser.

use trivet::errors::ParseResult;
use trivet::parse_from_stdin;

pub fn main() -> ParseResult<()> {
    let mut parser = parse_from_stdin();
    while !parser.is_at_eof() {
        // Read some bytes and then write them out.
        let value = parser.peek_n(57);
        // We can't use value.len() because that is in bytes, not characters.
        for _ in value.chars() {
            parser.consume();
        }
        print!("{}", value);
    }
    Ok(())
}