From c929988d4a9640fb80b8d6096311f66d363d1f09 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 14 Dec 2024 15:18:56 +0900 Subject: [PATCH] Add README.md and remove others --- README | 1 - README.md | 34 ++++++++++++++++++++++++++++++++++ README.rst | 36 ------------------------------------ 3 files changed, 34 insertions(+), 37 deletions(-) delete mode 100644 README create mode 100644 README.md delete mode 100644 README.rst diff --git a/README b/README deleted file mode 100644 index 5ccc0ea..0000000 --- a/README +++ /dev/null @@ -1 +0,0 @@ -See README.rst diff --git a/README.md b/README.md new file mode 100644 index 0000000..e513842 --- /dev/null +++ b/README.md @@ -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 diff --git a/README.rst b/README.rst deleted file mode 100644 index 03ee0f8..0000000 --- a/README.rst +++ /dev/null @@ -1,36 +0,0 @@ -sfparse-rs -========== - -sfparse-rs is `RFC 9651 -`_ Structured Field -Values parser written in Rust. It is the port of `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. - -.. code-block:: 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