pub struct CheckpointManager { /* private fields */ }Expand description
Manager for handling multiple checkpoints.
Implementations§
Source§impl CheckpointManager
impl CheckpointManager
Sourcepub fn new<P: AsRef<Path>>(checkpoint_dir: P) -> TlBackendResult<Self>
pub fn new<P: AsRef<Path>>(checkpoint_dir: P) -> TlBackendResult<Self>
Create a new checkpoint manager.
Sourcepub fn set_max_checkpoints(&mut self, max: Option<usize>)
pub fn set_max_checkpoints(&mut self, max: Option<usize>)
Set the maximum number of checkpoints to keep.
Sourcepub fn set_filename_pattern(&mut self, pattern: String)
pub fn set_filename_pattern(&mut self, pattern: String)
Set the filename pattern for checkpoints.
Sourcepub fn save_checkpoint(
&self,
executor: &Scirs2Exec,
iteration: usize,
) -> TlBackendResult<PathBuf>
pub fn save_checkpoint( &self, executor: &Scirs2Exec, iteration: usize, ) -> TlBackendResult<PathBuf>
Save a checkpoint and manage old checkpoints.
Sourcepub fn load_latest(&self) -> TlBackendResult<Checkpoint>
pub fn load_latest(&self) -> TlBackendResult<Checkpoint>
Load the latest checkpoint.
Sourcepub fn list_checkpoints(&self) -> TlBackendResult<Vec<PathBuf>>
pub fn list_checkpoints(&self) -> TlBackendResult<Vec<PathBuf>>
List all checkpoints in the directory.
Auto Trait Implementations§
impl Freeze for CheckpointManager
impl RefUnwindSafe for CheckpointManager
impl Send for CheckpointManager
impl Sync for CheckpointManager
impl Unpin for CheckpointManager
impl UnwindSafe for CheckpointManager
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> 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