Skip to content

Commit

Permalink
Add README.md and remove others
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsuhiro-t committed Dec 14, 2024
1 parent 1860593 commit c929988
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 37 deletions.
1 change: 0 additions & 1 deletion README

This file was deleted.

34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# sfparse-rs

sfparse-rs is [RFC
9651](https://datatracker.ietf.org/doc/html/rfc9651) Structured Field
Values parser written in Rust. It is the port of
[sfparse](https://github.com/ngtcp2/sfparse) written in C.

It is designed not to do any extra allocation, like allocating maps,
lists, and Strings, and do the minimal stuff to parse the input data.

```rust
use sfparse::{Parser, Value};

let mut urgency :i32 = 3;
let mut incremental = false;
let mut p = Parser::new("u=2, i".as_bytes());

loop {
match p.parse_dict().unwrap() {
None => break,
Some(("u", Value::Integer(v))) if (0i64..=7i64).contains(&v) => urgency = v as i32,
Some(("i", Value::Bool(v))) => incremental = v,
_ => (),
}
}

println!("urgency={urgency} incremental={incremental}");
```

## License

The MIT License

Copyright (c) 2024 sfparse-rs contributors
36 changes: 0 additions & 36 deletions README.rst

This file was deleted.

0 comments on commit c929988

Please sign in to comment.