#url #serialization #serde

serde_url_params

URL parameters serialization

4 releases

0.2.1 Jan 16, 2021
0.2.0 Jan 9, 2020
0.1.1 Sep 25, 2018
0.1.0 Aug 24, 2017

#719 in Encoding

Download history 2285/week @ 2024-07-24 1799/week @ 2024-07-31 2050/week @ 2024-08-07 1869/week @ 2024-08-14 2263/week @ 2024-08-21 3780/week @ 2024-08-28 4353/week @ 2024-09-04 4274/week @ 2024-09-11 4085/week @ 2024-09-18 3022/week @ 2024-09-25 3896/week @ 2024-10-02 8699/week @ 2024-10-09 9082/week @ 2024-10-16 9767/week @ 2024-10-23 8202/week @ 2024-10-30 5979/week @ 2024-11-06

34,325 downloads per month
Used in 21 crates (17 directly)

MIT/Apache

33KB
892 lines

Serde URL Params

crates-badge docs-badge license-badge ci-badge

Serialization of URL parameters from Rust structs.

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("boxdot"),
    filter: vec![Filter::New, Filter::Blocked],
};
assert_eq!(
    serde_url_params::to_string(&params).unwrap(),
    "cursor=42&username=boxdot&filter=New&filter=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

~2.1–3MB
~56K SLoC