use err::Error; use serde::Serialize; pub type ItemSerBox = Box; pub trait ItemSer { fn serialize(&self) -> Result, Error>; } impl ItemSer for T where T: Serialize, { fn serialize(&self) -> Result, Error> { let u = serde_json::to_vec(self)?; Ok(u) } }