Function serde_bytes::deserialize [] [src]

pub fn deserialize<'de, T, D>(deserializer: D) -> Result<T, D::Error> where T: From<Vec<u8>>, D: Deserializer<'de>

Serde deserialize_with function to deserialize bytes efficiently.

This function can be used with either of the following Serde attributes:

#[macro_use]
extern crate serde_derive;

extern crate serde;
extern crate serde_bytes;

#[derive(Deserialize)]
struct Packet {
    #[serde(with = "serde_bytes")]
    payload: Vec<u8>,
}