File tree Expand file tree Collapse file tree 3 files changed +34
-37
lines changed Expand file tree Collapse file tree 3 files changed +34
-37
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 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
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments