passthrough/passthrough.rs
1//! Just a test of the buffering in the parser.
2
3use trivet::errors::ParseResult;
4use trivet::parse_from_stdin;
5
6pub fn main() -> ParseResult<()> {
7 let mut parser = parse_from_stdin();
8 while !parser.is_at_eof() {
9 // Read some bytes and then write them out.
10 let value = parser.peek_n(57);
11 // We can't use value.len() because that is in bytes, not characters.
12 for _ in value.chars() {
13 parser.consume();
14 }
15 print!("{}", value);
16 }
17 Ok(())
18}