Skip to main content

ComponentTrait

Trait ComponentTrait 

Source
pub trait ComponentTrait {
    // Required methods
    fn component_type() -> Symbol;
    fn serialize(&self, env: &Env) -> Bytes;
    fn deserialize(env: &Env, data: &Bytes) -> Option<Self>
       where Self: Sized;

    // Provided method
    fn default_storage() -> ComponentStorage { ... }
}

Required Methods§

Source

fn component_type() -> Symbol

Source

fn serialize(&self, env: &Env) -> Bytes

Source

fn deserialize(env: &Env, data: &Bytes) -> Option<Self>
where Self: Sized,

Provided Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§