Serializable

Trait Serializable 

Source
pub trait Serializable {
    // Required methods
    fn to_json(&self) -> String;
    fn to_msg(&self) -> Result<Vec<u8>, ValueWriteError>;
}
Expand description

Serialization trait which all types you intend to put in a Tree need to implement.

Required Methods§

Source

fn to_json(&self) -> String

Return object intensive json string

§I.E.

FourVec -> {"x0":1.0,"x1":0.0,"x2":0.0,"x3":0.0}

Source

fn to_msg(&self) -> Result<Vec<u8>, ValueWriteError>

Return Result wrapped Vec in MsgPack Format is not like to_json it is array intensive not object

#Errors

  • The rmp library returns ValueWriteError on write errors

Implementations on Foreign Types§

Source§

impl Serializable for f64

Source§

impl Serializable for u64

Source§

impl Serializable for String

Wraps the String in quotes(“”).

Implementors§