pub struct SnapshotManager { /* private fields */ }Expand description
Manages file snapshots using a shadow git repository.
Implementations§
Source§impl SnapshotManager
impl SnapshotManager
Sourcepub fn new(project_dir: &Path) -> Self
pub fn new(project_dir: &Path) -> Self
Create a new snapshot manager for the given project directory.
Sourcepub fn snapshot_dir(&self) -> &Path
pub fn snapshot_dir(&self) -> &Path
Path to the snapshot directory.
Sourcepub fn take_snapshot(&mut self, files: &[&str], label: &str) -> Option<String>
pub fn take_snapshot(&mut self, files: &[&str], label: &str) -> Option<String>
Take a snapshot of the given files before modification.
Returns the snapshot ID (git commit hash) or None on failure.
Sourcepub fn get_diff(&mut self, snapshot_id: &str) -> Option<String>
pub fn get_diff(&mut self, snapshot_id: &str) -> Option<String>
Get diff between a snapshot and the current project state.
Sourcepub fn revert_to_snapshot(&mut self, snapshot_id: &str) -> Vec<String>
pub fn revert_to_snapshot(&mut self, snapshot_id: &str) -> Vec<String>
Revert project files to a snapshot state.
Returns list of reverted file paths.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SnapshotManager
impl RefUnwindSafe for SnapshotManager
impl Send for SnapshotManager
impl Sync for SnapshotManager
impl Unpin for SnapshotManager
impl UnsafeUnpin for SnapshotManager
impl UnwindSafe for SnapshotManager
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