Trait State Hooks
pub trait StateHooks {
// Provided methods
fn migrate(&self, _saved: &mut SavedState) -> Result<(), StateError> { ... }
fn import(&self, _bytes: &[u8]) -> Option<SavedState> { ... }
}Expand description
Product hooks for older and foreign state. Both run on a control thread.
Provided Methods§
fn migrate(&self, _saved: &mut SavedState) -> Result<(), StateError>
fn migrate(&self, _saved: &mut SavedState) -> Result<(), StateError>
Update state written by an earlier product state version. On return, parameters are matched to the current product by ID: unknown IDs are dropped and missing ones take defaults.
fn import(&self, _bytes: &[u8]) -> Option<SavedState>
fn import(&self, _bytes: &[u8]) -> Option<SavedState>
Convert data without the RAVET magic, for example sessions written by an
earlier framework. Return None to reject it. The result is treated as
the current product state version.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".