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§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".