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::ContentType
hyper::header::Headers
hyper::http::RawStatus
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)
How do I send Cookie
values as part of an IPC channel?
Use the Serde
wrapper. It implements Deref
and DerefMut
for convenience.
ipc::channel::<Serde<Cookie>>()
Structs
De |
A wrapper to deserialize Hyper types. |
Ser |
A wrapper to serialize Hyper types. |
Serde |
A convenience wrapper to be used as a type parameter, for example when
a |
Functions
deserialize |
Deserialises a |
serialize |
Serialises |