pub struct Checkpoint { /* private fields */ }Expand description
A checkpoint represents a saved state of the notebook
Contains all variables, functions, and execution state at a point in time.
§Examples
use ruchy::notebook::persistence::Checkpoint;
let checkpoint = Checkpoint::new("initial_state".to_string());
assert_eq!(checkpoint.name(), "initial_state");
assert_eq!(checkpoint.variable_count(), 0);Implementations§
Source§impl Checkpoint
impl Checkpoint
Sourcepub fn new(name: String) -> Self
pub fn new(name: String) -> Self
Create a new empty checkpoint
§Examples
use ruchy::notebook::persistence::Checkpoint;
let checkpoint = Checkpoint::new("checkpoint1".to_string());
assert_eq!(checkpoint.name(), "checkpoint1");Sourcepub fn with_state(name: String, state_data: HashMap<String, String>) -> Self
pub fn with_state(name: String, state_data: HashMap<String, String>) -> Self
Create a checkpoint with state data
Sourcepub fn state_data(&self) -> &HashMap<String, String>
pub fn state_data(&self) -> &HashMap<String, String>
Get the state data
Sourcepub fn variable_count(&self) -> usize
pub fn variable_count(&self) -> usize
Get number of variables in checkpoint
Sourcepub fn has_variable(&self, name: &str) -> bool
pub fn has_variable(&self, name: &str) -> bool
Check if checkpoint has a specific variable
Sourcepub fn get_variable(&self, name: &str) -> Option<&String>
pub fn get_variable(&self, name: &str) -> Option<&String>
Get variable value from checkpoint
Sourcepub fn timestamp(&self) -> SystemTime
pub fn timestamp(&self) -> SystemTime
Get timestamp
Trait Implementations§
Source§impl Clone for Checkpoint
impl Clone for Checkpoint
Source§fn clone(&self) -> Checkpoint
fn clone(&self) -> Checkpoint
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Checkpoint
impl Debug for Checkpoint
Source§impl PartialEq for Checkpoint
impl PartialEq for Checkpoint
impl StructuralPartialEq for Checkpoint
Auto Trait Implementations§
impl Freeze for Checkpoint
impl RefUnwindSafe for Checkpoint
impl Send for Checkpoint
impl Sync for Checkpoint
impl Unpin for Checkpoint
impl UnwindSafe for Checkpoint
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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