hyper::__hyper_generate_header_serialization! [] [src]

macro_rules! __hyper_generate_header_serialization {
    ($id:ident) => {
        #[cfg(feature = "serde-serialization")]
        impl ::serde::Serialize for $id {
            fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error>
                            where S: ::serde::Serializer {
                format!("{}", self).serialize(serializer)
            }
        }

        #[cfg(feature = "serde-serialization")]
        impl ::serde::Deserialize for $id {
            fn deserialize<D>(deserializer: &mut D) -> Result<$id, D::Error>
                              where D: ::serde::Deserializer {
                let string_representation: String =
                    try!(::serde::Deserialize::deserialize(deserializer));
                Ok($crate::header::Header::parse_header(&[
                    string_representation.into_bytes()
                ]).unwrap())
            }
        }
    }
}