#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

#538 in Encoding

Download history 3169/week @ 2024-03-14 2721/week @ 2024-03-21 2326/week @ 2024-03-28 2866/week @ 2024-04-04 2726/week @ 2024-04-11 2906/week @ 2024-04-18 2636/week @ 2024-04-25 2779/week @ 2024-05-02 2774/week @ 2024-05-09 2947/week @ 2024-05-16 3049/week @ 2024-05-23 2736/week @ 2024-05-30 2556/week @ 2024-06-06 2537/week @ 2024-06-13 2371/week @ 2024-06-20 2022/week @ 2024-06-27

10,061 downloads per month
Used in 19 crates (16 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

~1.1–1.6MB
~55K SLoC