pub struct StateManager { /* private fields */ }Expand description
State manager for plugin hot-reload
Implementations§
Source§impl StateManager
impl StateManager
Sourcepub fn with_max_history(self, max: usize) -> Self
pub fn with_max_history(self, max: usize) -> Self
Set maximum history entries
Sourcepub fn with_persistence<P: AsRef<Path>>(self, dir: P) -> Self
pub fn with_persistence<P: AsRef<Path>>(self, dir: P) -> Self
Enable state persistence
Sourcepub async fn save_snapshot(&self, snapshot: StateSnapshot) -> Result<(), String>
pub async fn save_snapshot(&self, snapshot: StateSnapshot) -> Result<(), String>
Save a state snapshot
Sourcepub async fn load_snapshot(&self, plugin_id: &str) -> Option<StateSnapshot>
pub async fn load_snapshot(&self, plugin_id: &str) -> Option<StateSnapshot>
Load a state snapshot
Sourcepub async fn get_latest(&self, plugin_id: &str) -> Option<StateSnapshot>
pub async fn get_latest(&self, plugin_id: &str) -> Option<StateSnapshot>
Get the latest snapshot for a plugin
Sourcepub async fn rollback(&self, plugin_id: &str) -> Option<StateSnapshot>
pub async fn rollback(&self, plugin_id: &str) -> Option<StateSnapshot>
Rollback to a previous snapshot
Sourcepub async fn get_history(&self, plugin_id: &str) -> Vec<StateSnapshot>
pub async fn get_history(&self, plugin_id: &str) -> Vec<StateSnapshot>
Get history for a plugin
Sourcepub async fn plugin_ids(&self) -> Vec<String>
pub async fn plugin_ids(&self) -> Vec<String>
Get all managed plugin IDs
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StateManager
impl !RefUnwindSafe for StateManager
impl Send for StateManager
impl Sync for StateManager
impl Unpin for StateManager
impl UnsafeUnpin for StateManager
impl !UnwindSafe for StateManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more