pub struct FileSnapshot {
pub path: PathBuf,
pub change: FileChange,
pub before: Option<String>,
pub after_len: u64,
pub after_hash: u64,
pub added: usize,
pub removed: usize,
pub restorable: bool,
}Expand description
One file as it was before a patch touched it, with a fingerprint of what the patch left behind so a later restore can tell whether anything else has changed the file since.
Fields§
§path: PathBuf§change: FileChange§before: Option<String>§after_len: u64§after_hash: u64§added: usize§removed: usize§restorable: boolFalse when the previous contents were too large to keep, which is reported rather than silently truncated.
Implementations§
Source§impl FileSnapshot
impl FileSnapshot
Sourcepub fn restore_blocker(&self) -> Option<String>
pub fn restore_blocker(&self) -> Option<String>
Why this snapshot cannot be put back, or None when it can. A file the
agent wrote and something else then edited is left alone: reverting it
would throw away the other edit.
Sourcepub fn restore(&self) -> Result<()>
pub fn restore(&self) -> Result<()>
Puts the file back as it was. Callers are expected to have checked
Self::restore_blocker first.
Trait Implementations§
Source§impl Clone for FileSnapshot
impl Clone for FileSnapshot
Source§fn clone(&self) -> FileSnapshot
fn clone(&self) -> FileSnapshot
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 FileSnapshot
impl Debug for FileSnapshot
impl Eq for FileSnapshot
Source§impl PartialEq for FileSnapshot
impl PartialEq for FileSnapshot
impl StructuralPartialEq for FileSnapshot
Auto Trait Implementations§
impl Freeze for FileSnapshot
impl RefUnwindSafe for FileSnapshot
impl Send for FileSnapshot
impl Sync for FileSnapshot
impl Unpin for FileSnapshot
impl UnsafeUnpin for FileSnapshot
impl UnwindSafe for FileSnapshot
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.