Trait sapio_base::simp::SIMP

source ·
pub trait SIMP {
    // Required methods
    fn static_get_protocol_number() -> i64
       where Self: Sized;
    fn get_protocol_number(&self) -> i64;
    fn to_json(&self) -> Result<Value, Error>;
    fn from_json(value: Value) -> Result<Self, Error>
       where Self: Sized;
}
Expand description

Trait for Sapio Interactive Metadata Protocol Implementors

Required Methods§

source

fn static_get_protocol_number() -> i64
where Self: Sized,

Get a protocol number, which should be one that is assigned through the SIMP repo. Proprietary SIMPs can safely use negative numbers.

source

fn get_protocol_number(&self) -> i64

Get a protocol number, which should be one that is assigned through the SIMP repo. Proprietary SIMPs can safely use negative numbers.

Should be implementd as a pass throught to Self::static_get_protocol_number, but the trait system can’t express that

source

fn to_json(&self) -> Result<Value, Error>

Conver a SIMP to a JSON. Concretely typed so that SIMP can be a trait object.

source

fn from_json(value: Value) -> Result<Self, Error>
where Self: Sized,

Conver a SIMP from a JSON. Sized bound so that SIMP can be a trait object.

Implementors§