pub struct FileHistory { /* private fields */ }Expand description
Pre-edit file snapshots for rollback safety.
Before the first edit to any file in a session, stores the original content. If the file didn’t exist before the edit, nothing is stored. Enables rollback to pre-session state if the agent makes bad edits.
Implementations§
Source§impl FileHistory
impl FileHistory
pub fn new() -> Self
Sourcepub fn snapshot_before_edit(&self, path: &Path) -> Result<()>
pub fn snapshot_before_edit(&self, path: &Path) -> Result<()>
Store original content if not already stored for this path (first edit wins). Does nothing if the file doesn’t exist (new file creation).
Sourcepub fn original(&self, path: &Path) -> Option<String>
pub fn original(&self, path: &Path) -> Option<String>
Get the original content of a file (before any edits in this session).
Sourcepub fn tracked_files(&self) -> Vec<PathBuf>
pub fn tracked_files(&self) -> Vec<PathBuf>
List all files with snapshots.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for FileHistory
impl RefUnwindSafe for FileHistory
impl Send for FileHistory
impl Sync for FileHistory
impl Unpin for FileHistory
impl UnsafeUnpin for FileHistory
impl UnwindSafe for FileHistory
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> 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