#serialization #url #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

#548 in Encoding

Download history 3801/week @ 2024-11-18 3268/week @ 2024-11-25 3149/week @ 2024-12-02 3549/week @ 2024-12-09 2792/week @ 2024-12-16 814/week @ 2024-12-23 1882/week @ 2024-12-30 2995/week @ 2025-01-06 2774/week @ 2025-01-13 2667/week @ 2025-01-20 3127/week @ 2025-01-27 3674/week @ 2025-02-03 3639/week @ 2025-02-10 4207/week @ 2025-02-17 3785/week @ 2025-02-24 3921/week @ 2025-03-03

15,734 downloads per month
Used in 20 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–3MB
~55K SLoC