1 2 3 4 5 6 7 8 9 10 11 12 13
use std::convert::{TryFrom, TryInto}; use std::sync::{Arc, Mutex}; use bytes::Bytes; use failure::Error; pub trait Serialize: TryInto<Bytes, Error = Error> { fn try_into_bytes(self) -> Result<Bytes, Error> { self.try_into() } } pub trait Deserialize: TryFrom<Arc<Mutex<Bytes>>, Error = Error> {}