#url #serializer #http #serialization #serde #types #params #parameters

url_params_serializer

Allows serialization of types to URL GET parameters

2 releases

0.1.1 Dec 23, 2018
0.1.0 Dec 23, 2018
Download history 16/week @ 2021-08-10 31/week @ 2021-08-17 8/week @ 2021-08-24 66/week @ 2021-08-31 47/week @ 2021-09-07 49/week @ 2021-09-14 48/week @ 2021-09-21 28/week @ 2021-09-28 43/week @ 2021-10-05 8/week @ 2021-10-12 27/week @ 2021-10-19 28/week @ 2021-10-26 26/week @ 2021-11-02 27/week @ 2021-11-09 4/week @ 2021-11-16 30/week @ 2021-11-23

87 downloads per month

Apache-2.0

21KB
498 lines

url_params_serializer

Allows the serialization of types which implement Serde's Serializer trait to HTTP GET query parameters. Typical usage:

use serde_derive::Serialize;
use url::Url;
use url_params_serializer::to_url_params;

#[derive(Serialize)]
struct Params {
    bar: &'static str;
    baz: usize
}

let params = Params { bar: "spam", baz: 5 };
let url = Url::parse_with_params("https://foo.com", to_url_params(params));

assert_eq!(url.into_string(), "https://foo.com/?bar=spam&baz=5");

Some more complex types can be serialized too; see the documentation for to_url_params for more information.


lib.rs:

Allows the serialization of types which implement Serde's Serializer trait to HTTP GET query parameters. Typical usage:

use serde_derive::Serialize;
use url::Url;
use url_params_serializer::to_url_params;

#[derive(Serialize)]
struct Params {
    bar: &'static str,
    baz: usize,
}

let params = Params { bar: "spam", baz: 5 };
let url = Url::parse_with_params("https://foo.com", to_url_params(params)).unwrap();

assert_eq!(url.into_string(), "https://foo.com/?bar=spam&baz=5");

Some more complex types can be serialized too; see the documentation for to_url_params for more information.

Dependencies

~140–260KB