serde_url_params

Crates.ioserde_url_params
lib.rsserde_url_params
version0.2.1
sourcesrc
created_at2017-08-24 17:21:59.55087
updated_at2021-01-16 22:30:56.897443
descriptionURL parameters serialization
homepage
repositoryhttps://github.com/boxdot/serde-url-params-rs
max_upload_size
id28861
size44,648
(boxdot)

documentation

README

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.

Commit count: 22

cargo fmt