sfparse/lib.rs
1//! [RFC 9651](https://datatracker.ietf.org/doc/html/rfc9651)
2//! Structured Field Values parser.
3//!
4//! Provides Structured Field Values parser that is designed not to do
5//! any extra allocation, like allocating maps, lists, and Strings,
6//! and do the minimal stuff to parse the input data.
7//!
8//! This is an example of parsing [RFC
9//! 9218](https://datatracker.ietf.org/doc/html/rfc9218) Priority
10//! header field:
11//!
12//! ```
13//! use sfparse::{Parser, Value};
14//!
15//! let mut urgency :i32 = 3;
16//! let mut incremental = false;
17//! let mut p = Parser::new("u=2, i".as_bytes());
18//!
19//! loop {
20//! match p.parse_dict().unwrap() {
21//! None => break,
22//! Some(("u", Value::Integer(v))) if (0i64..=7i64).contains(&v) => urgency = v as i32,
23//! Some(("i", Value::Bool(v))) => incremental = v,
24//! _ => (),
25//! }
26//! }
27//!
28//! println!("urgency={urgency} incremental={incremental}");
29//! ```
30mod parser;
31mod utf8;
32mod value;
33
34pub use crate::parser::{Parser, Error};
35pub use crate::value::Value;