libmilkyway 0.1.0

libmilkyway is a part of milkyway project providing common protocols for communicating between MilkyWay modules
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::serialization::serializable::Serialized;
use crate::serialization::error::SerializationError;

///
/// The structure which may can be created from Serialized data.
///
pub trait Deserializable: Sized {
    ///
    /// Creates structure from serialized data.
    /// Returns either pair (result, offset) or error.
    /// # Arguments
    ///
    /// * `serialized`: Serialized data to make struct from
    ///
    /// returns: Result<(Self, usize), SerializationError>
    ///
    fn from_serialized(serialized: &Serialized) -> Result<(Self, usize), SerializationError>;
}