better errors for keys without values

This commit is contained in:
Robin Appelman 2023-12-15 17:48:56 +01:00
commit 9c06896b34
8 changed files with 191 additions and 6 deletions

16
examples/tokens.rs Normal file
View file

@ -0,0 +1,16 @@
use miette::{Context, IntoDiagnostic, Result};
use std::env::args;
use std::fs::read_to_string;
use vdf_reader::Reader;
fn main() -> Result<()> {
let path = args().nth(1).expect("no path provided");
let raw = read_to_string(path)
.into_diagnostic()
.wrap_err("failed to read input")?;
let reader = Reader::from(raw.as_str());
for event in reader {
println!("{:?}", event?);
}
Ok(())
}