Crates.io | serde_url_params |
lib.rs | serde_url_params |
version | 0.2.1 |
source | src |
created_at | 2017-08-24 17:21:59.55087 |
updated_at | 2021-01-16 22:30:56.897443 |
description | URL parameters serialization |
homepage | |
repository | https://github.com/boxdot/serde-url-params-rs |
max_upload_size | |
id | 28861 |
size | 44,648 |
Serialization of URL parameters from Rust structs.
#[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(¶ms).unwrap(),
"cursor=42&username=boxdot&filter=New&filter=Blocked"
);
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.