Skip to content

Commit 5485bf7

Browse files
authored
Merge pull request #5 from ngtcp2/readme-md
Add README.md and remove others
2 parents 1860593 + c929988 commit 5485bf7

File tree

3 files changed

+34
-37
lines changed

3 files changed

+34
-37
lines changed

README

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# sfparse-rs
2+
3+
sfparse-rs is [RFC
4+
9651](https://datatracker.ietf.org/doc/html/rfc9651) Structured Field
5+
Values parser written in Rust. It is the port of
6+
[sfparse](https://github.com/ngtcp2/sfparse) written in C.
7+
8+
It is designed not to do any extra allocation, like allocating maps,
9+
lists, and Strings, and do the minimal stuff to parse the input data.
10+
11+
```rust
12+
use sfparse::{Parser, Value};
13+
14+
let mut urgency :i32 = 3;
15+
let mut incremental = false;
16+
let mut p = Parser::new("u=2, i".as_bytes());
17+
18+
loop {
19+
match p.parse_dict().unwrap() {
20+
None => break,
21+
Some(("u", Value::Integer(v))) if (0i64..=7i64).contains(&v) => urgency = v as i32,
22+
Some(("i", Value::Bool(v))) => incremental = v,
23+
_ => (),
24+
}
25+
}
26+
27+
println!("urgency={urgency} incremental={incremental}");
28+
```
29+
30+
## License
31+
32+
The MIT License
33+
34+
Copyright (c) 2024 sfparse-rs contributors

README.rst

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)