Crate hyper_serde [−] [src]
This crate provides wrappers and convenience functions to make Hyper and Serde work hand in hand.
The supported types are:
cookie::Cookie
hyper::header::Headers
hyper::method::Method
How do I use a data type with a Headers
member with Serde?
Use the serde attributes deserialize_with
and serialize_with
.
struct MyStruct { #[serde(deserialize_with = "hyper_serde::deserialize", serialize_with = "hyper_serde::serialize")] headers: Headers, }
How do I encode a Headers
value with serde_json::to_string
?
Use the Ser
wrapper.
serde_json::to_string(&Ser::new(&headers))
How do I decode a Method
value with serde_json::parse
?
Use the De
wrapper.
serde_json::parse::<De<Method>>("\"PUT\"").map(De::into_inner)
Structs
De |
A wrapper to deserialize Hyper types.
A
This is useful with functions such as |
Ser |
A wrapper to serialize Hyper types. |
Functions
deserialize |
Deserialises a |
serialize |
Serialises |