A minimal byte-by-byte reader for parsing input.
Following situation:
I want to read and parse some input, but it's not so large-scale parsing task, so I'd like to avoid adding a heavyweight crate like nom or nom8 to my
dependencies...
```rust use byte_reader::Reader;
fn main() {
// Get a input from a File, standard input, or others
// Input must implement AsRef<[u8]>
let sampleinput = "Hello, bytereader!";
// Create mutable `r` from input
let mut r = Reader::from(sample_input);
// Use some simple operations
// to parse the input
r.consume("Hello").unwrap();
r.consume(",").unwrap();
r.skip_whitespace();
let name = r.read_snake().unwrap(); // byte_reader
r.consume("!").unwrap();
println!("Greeted to `{name}`.");
} ```
advance_by, unwind_bynext, next_ifpeek, peek2, peek3consume, consume_oneofskip_while, skip_whitespaceread_whileread_uint, read_intread_string, read_string_uncheckedread_camel, read_snake, read_kebab"location"You can track the reader's parsing location ( line and column ) in the input bytes.
```rust /* enable "location" feature */ use byte_reader::Reader;
fn main() { let mut r = Reader::new("Hello, byte_reader!");
r.consume("Hello").unwrap();
r.consume(",").unwrap();
r.skip_whitespace();
let name_line = r.line; // 1
let name_column = r.column; // 11
let name = r.read_snake().unwrap(); // byte_reader
r.consume("!").unwrap();
println!("Greeted to `{name}`.");
println!("In the input, the name starts at column {name_column} of line {name_line}");
} ```
byte_reader is licensed under the MIT License (LICENSE or https://opensource.org/licenses/MIT).