Yiming Jing | ebb1872 | 2021-07-16 13:15:12 -0700 | [diff] [blame] | 1 | //! Common traits |
2 | |||||
3 | /// Common trait for structures serialization | ||||
4 | pub trait Serialize<O = Vec<u8>> { | ||||
5 | /// Type of serialization error | ||||
6 | type Error; | ||||
7 | /// Try to serialize object | ||||
8 | fn serialize(&self) -> Result<O, Self::Error>; | ||||
9 | } |