#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

#750 in Encoding

Download history 3606/week @ 2024-09-21 3744/week @ 2024-09-28 6656/week @ 2024-10-05 8571/week @ 2024-10-12 10369/week @ 2024-10-19 8620/week @ 2024-10-26 7054/week @ 2024-11-02 7994/week @ 2024-11-09 3788/week @ 2024-11-16 3317/week @ 2024-11-23 3047/week @ 2024-11-30 3576/week @ 2024-12-07 2884/week @ 2024-12-14 877/week @ 2024-12-21 1834/week @ 2024-12-28 2193/week @ 2025-01-04

8,281 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–3MB
~55K SLoC