pub struct SnapshotManager { /* private fields */ }Implementations§
Source§impl SnapshotManager
impl SnapshotManager
pub fn new<P: AsRef<Path>>(repo_path: P) -> Result<Self>
Sourcepub fn list_snapshots(&self) -> Result<()>
pub fn list_snapshots(&self) -> Result<()>
List all snapshots
Sourcepub fn restore_snapshot(&self, id: &str) -> Result<()>
pub fn restore_snapshot(&self, id: &str) -> Result<()>
Restore from a snapshot
Sourcepub fn delete_snapshot(&self, id: &str) -> Result<()>
pub fn delete_snapshot(&self, id: &str) -> Result<()>
Delete a snapshot
Sourcepub fn clear_all(&self) -> Result<usize>
pub fn clear_all(&self) -> Result<usize>
Delete every snapshot in this repo. Returns the count deleted so the CLI can report it. Idempotent — empty dir returns 0.
Sourcepub fn show(&self, id: &str) -> Result<()>
pub fn show(&self, id: &str) -> Result<()>
Print everything we have on one snapshot: metadata + bundle layout. Doesn’t try to list every file under git_backup (could be huge); shows the top-level entries so the user knows it’s a real backup.
Sourcepub fn configure_auto_snapshot(
&self,
enable: bool,
interval: Option<u32>,
) -> Result<()>
pub fn configure_auto_snapshot( &self, enable: bool, interval: Option<u32>, ) -> Result<()>
Configure auto-snapshot settings
Sourcepub fn stash(&self, name: Option<&str>, include_untracked: bool) -> Result<()>
pub fn stash(&self, name: Option<&str>, include_untracked: bool) -> Result<()>
Save work temporarily (like git stash).
Uses libgit2’s native stash API rather than the snapshot bundle path.
The previous implementation copied .git/ and reset HEAD, which
silently dropped working-tree changes — git_backup only contains
committed history, so any uncommitted edits were unrecoverable.
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