Deserializable

Trait Deserializable 

Source
pub trait Deserializable {
    // Required methods
    fn from_json(string: &str) -> Result<Self, Box<dyn Error>>
       where Self: Sized;
    fn from_msg(bytes: &[u8]) -> Result<(Self, &[u8]), Box<dyn Error>>
       where Self: Sized;
}
Expand description

Deserialization trait which all types you intend to get out of a Tree need to implement. Really only designed to work with data that was serialized with the Calcify::Serializable trait and will not work on arbitrarily modified tree files

Required Methods§

Source

fn from_json(string: &str) -> Result<Self, Box<dyn Error>>
where Self: Sized,

Return Self from string

Source

fn from_msg(bytes: &[u8]) -> Result<(Self, &[u8]), Box<dyn Error>>
where Self: Sized,

Return a tuple of Self and a &u8 of remaining unparsed bytes from a byte array

Implementations on Foreign Types§

Source§

impl Deserializable for f64

Source§

fn from_json(string: &str) -> Result<Self, Box<dyn Error>>

Source§

fn from_msg(bytes: &[u8]) -> Result<(Self, &[u8]), Box<dyn Error>>

Source§

impl Deserializable for u64

Source§

fn from_json(string: &str) -> Result<Self, Box<dyn Error>>

Source§

fn from_msg(bytes: &[u8]) -> Result<(Self, &[u8]), Box<dyn Error>>

Implementors§