Expand description
This crate provides wrappers and convenience functions to make rust-url and Serde work hand in hand.
The supported types are:
url::Url
§How do I use a data type with a Url member with Serde?
Use the serde attributes deserialize_with and serialize_with.
#[derive(serde::Serialize, serde::Deserialize)]
struct MyStruct {
#[serde(with = "url_serde")]
url: Url,
}§How do I encode a Url value with serde_json::to_string?
Use the Ser wrapper.
serde_json::to_string(&Ser::new(&url))§How do I decode a Url value with serde_json::parse?
Use the De wrapper.
serde_json::from_str(r"http:://www.rust-lang.org").map(De::into_inner)§How do I send Url values as part of an IPC channel?
Use the Serde wrapper. It implements Deref and DerefMut for convenience.
ipc::channel::<Serde<Url>>()Structs§
- De
- A wrapper to deserialize
rust-urltypes. - Ser
- A wrapper to serialize
rust-urltypes. - Serde
- A convenience wrapper to be used as a type parameter, for example when
a
Vec<T>or anHashMap<K, V>need to be passed to serde.
Functions§
- deserialize
- Deserialises a
Tvalue with a given deserializer. - serialize
- Serialises
valuewith a given serializer.
Type Aliases§
- Serde
Url - A convenience type alias for Serde
.