Skip to main content

State

Trait State 

Source
pub trait State: Sized + Default {
    // Required methods
    fn serialize(&self) -> Vec<u8> ;
    fn deserialize(data: &[u8]) -> Option<Self>;
}
Expand description

Trait for custom plugin state structs.

Derive with #[derive(State)]. The struct must also implement Default so missing fields can be filled with defaults when loading old state.

Required Methods§

Source

fn serialize(&self) -> Vec<u8>

Source

fn deserialize(data: &[u8]) -> Option<Self>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§