mirror of
https://codeberg.org/icewind/vdf-reader.git
synced 2026-06-03 18:14:07 +02:00
better errors for keys without values
This commit is contained in:
parent
2f6fc3e180
commit
9c06896b34
8 changed files with 191 additions and 6 deletions
16
examples/tokens.rs
Normal file
16
examples/tokens.rs
Normal 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(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue