Trait revision::Revisioned 
source · pub trait Revisioned {
    // Required methods
    fn revision() -> u16;
    fn serialize_revisioned<W: Write>(&self, w: &mut W) -> Result<(), Error>;
    fn deserialize_revisioned<R: Read>(r: &mut R) -> Result<Self, Error>
       where Self: Sized;
    // Provided method
    fn type_id() -> TypeId
       where Self: 'static { ... }
}Expand description
Trait that provides an interface for version aware serialization and deserialization.
Example implementation
use revision::Error;
use revision::Revisioned;
struct MyType<T>(T);
impl<T> Revisioned for MyType<T>
where
    T: Revisioned,
{
    #[inline]
    fn serialize_revisioned<W: std::io::Write>(&self, writer: &mut W) -> Result<(), Error> {
        self.0.serialize_revisioned(writer)
    }
    #[inline]
    fn deserialize_revisioned<R: std::io::Read>(reader: &mut R) -> Result<Self, Error> {
        Ok(MyType(T::deserialize_revisioned(reader)?))
    }
    fn revision() -> u16 {
        1
    }
}