Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add README.md and remove others #5

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.