pub struct FilePersistence { /* private fields */ }Expand description
File-based state persistence.
Implementations§
Source§impl FilePersistence
impl FilePersistence
Sourcepub async fn ensure_dir(&self) -> Result<(), PersistenceError>
pub async fn ensure_dir(&self) -> Result<(), PersistenceError>
Ensure the directory exists.
Trait Implementations§
Source§impl<State, End> StatePersistence<State, End> for FilePersistencewhere
State: Serialize + DeserializeOwned + Send + Sync + 'static,
End: Serialize + DeserializeOwned + Send + Sync + 'static,
impl<State, End> StatePersistence<State, End> for FilePersistencewhere
State: Serialize + DeserializeOwned + Send + Sync + 'static,
End: Serialize + DeserializeOwned + Send + Sync + 'static,
Source§fn save_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
state: &'life2 State,
step: u32,
) -> Pin<Box<dyn Future<Output = Result<(), PersistenceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn save_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
state: &'life2 State,
step: u32,
) -> Pin<Box<dyn Future<Output = Result<(), PersistenceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Save state for a run.
Source§fn load_state<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<(State, u32)>, PersistenceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_state<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<(State, u32)>, PersistenceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load state for a run.
Source§fn save_result<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
result: &'life2 End,
) -> Pin<Box<dyn Future<Output = Result<(), PersistenceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn save_result<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
result: &'life2 End,
) -> Pin<Box<dyn Future<Output = Result<(), PersistenceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Save the final result.
Source§fn load_result<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<End>, PersistenceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_result<'life0, 'life1, 'async_trait>(
&'life0 self,
run_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<End>, PersistenceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load the final result.
Auto Trait Implementations§
impl Freeze for FilePersistence
impl RefUnwindSafe for FilePersistence
impl Send for FilePersistence
impl Sync for FilePersistence
impl Unpin for FilePersistence
impl UnwindSafe for FilePersistence
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