pub struct SandboxManager;Expand description
Low-level sandbox operations: create snapshots, compute changes, and roll back file state.
Implementations§
Source§impl SandboxManager
impl SandboxManager
Sourcepub fn create_snapshot(paths: &[PathBuf]) -> WorkspaceSnapshot
pub fn create_snapshot(paths: &[PathBuf]) -> WorkspaceSnapshot
Creates a snapshot of the given paths (files and directories).
Directories are walked recursively (respecting common ignore patterns). Files are hashed with SHA-256; content is stored for files <= 1 MB.
Sourcepub fn compute_changes(snapshot: &WorkspaceSnapshot) -> ChangeSet
pub fn compute_changes(snapshot: &WorkspaceSnapshot) -> ChangeSet
Compares the current filesystem state against a snapshot and returns a
ChangeSet describing what was added, modified, or deleted.
Sourcepub fn rollback(snapshot: &WorkspaceSnapshot) -> Result<(), String>
pub fn rollback(snapshot: &WorkspaceSnapshot) -> Result<(), String>
Rolls the workspace back to the state captured in snapshot.
- Files that were in the snapshot but are now missing or modified are restored from the stored content.
- Files that exist on disk but were NOT in the snapshot are deleted.
Returns an error when a file that needs restoration has no stored content (i.e. it was larger than 1 MB).
Sourcepub fn has_staged_changes() -> bool
pub fn has_staged_changes() -> bool
Checks whether the git index has staged (uncommitted) changes.
Runs git diff --cached --quiet and returns false if git is not
available or the command fails.
Auto Trait Implementations§
impl Freeze for SandboxManager
impl RefUnwindSafe for SandboxManager
impl Send for SandboxManager
impl Sync for SandboxManager
impl Unpin for SandboxManager
impl UnsafeUnpin for SandboxManager
impl UnwindSafe for SandboxManager
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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