3 unstable releases

0.2.1 Aug 2, 2022
0.2.0 Jun 28, 2022
0.1.0 Jun 21, 2022

#742 in Encoding

Download history 3671/week @ 2023-12-17 2844/week @ 2023-12-24 3010/week @ 2023-12-31 3653/week @ 2024-01-07 3474/week @ 2024-01-14 2987/week @ 2024-01-21 2943/week @ 2024-01-28 3435/week @ 2024-02-04 3548/week @ 2024-02-11 3897/week @ 2024-02-18 3042/week @ 2024-02-25 3075/week @ 2024-03-03 3572/week @ 2024-03-10 4093/week @ 2024-03-17 4389/week @ 2024-03-24 4106/week @ 2024-03-31

16,618 downloads per month
Used in 5 crates (2 directly)

MIT/Apache

36KB
962 lines

Yaup - Yet Another URL Params crate

This is a fork of serde_url_params. I updated the way of serializing arrays: Serializing { "food": ["baguette", "with", "cheese"] }

  • With serde_url_params returns food=baguette&food=with&food=cheese.
  • With yaup it returns food=baguette,with,cheese.

And I got rids of the serialization of embedded structures.

Example

#[derive(Debug, Serialize)]
enum Filter { New, Registered, Blocked }

#[derive(Debug, Serialize)]
struct Params {
    cursor: Option<usize>,
    per_page: Option<usize>,
    username: String,
    filter: Vec<Filter>,
}

let params = Params {
    cursor: Some(42),
    per_page: None,
    username: String::from("tamo"),
    filter: vec![Filter::New, Filter::Blocked],
};
assert_eq!(
    yaup::to_string(&params).unwrap(),
    "cursor=42&username=boxdot&filter=New,Blocked"
);

License

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this document by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~1.5–2MB
~67K SLoC