pub struct FileChange {
pub path: String,
pub old_path: Option<String>,
pub status: DiffStatus,
pub old_mode: FileMode,
pub new_mode: FileMode,
pub old_oid: ObjectId,
pub new_oid: ObjectId,
pub old_bytes: SideBytes,
pub new_bytes: SideBytes,
pub binary: bool,
pub content_changed: bool,
pub similarity: Option<u32>,
}Expand description
One changed path with both sides’ bytes loaded for diffing.
Fields§
§path: StringDisplay path (new path, or old path for a deletion).
old_path: Option<String>Pre-rename path, only when it differs from Self::path.
status: DiffStatusChange kind for this path.
old_mode: FileModeOld side mode (FileMode::ABSENT when the path is added).
new_mode: FileModeNew side mode (FileMode::ABSENT when the path is deleted).
old_oid: ObjectIdOld side object id (zero when absent).
new_oid: ObjectIdNew side object id (zero when absent or not yet hashed from the working tree).
old_bytes: SideBytesOld side contents (a Subproject commit line for gitlinks).
new_bytes: SideBytesNew side contents, read from the working tree for working-tree changes.
binary: boolEither side is treated as binary; binary sides may not carry their bytes.
content_changed: boolThe object ids differ (false for a mode-only change).
similarity: Option<u32>Rename or copy similarity (0–100), when applicable.
Implementations§
Source§impl FileChange
impl FileChange
Sourcepub fn structured(&self, options: DiffOptions) -> StructuredFileDiff
pub fn structured(&self, options: DiffOptions) -> StructuredFileDiff
Structured line hunks and mode metadata for this change.
Binary changes get mode metadata and no hunks.
§Parameters
options- line-diff settings (context, algorithm, whitespace handling).
Trait Implementations§
Source§impl Clone for FileChange
impl Clone for FileChange
Source§impl Debug for FileChange
impl Debug for FileChange
impl Eq for FileChange
Source§impl PartialEq for FileChange
impl PartialEq for FileChange
impl StructuralPartialEq for FileChange
Auto Trait Implementations§
impl Freeze for FileChange
impl RefUnwindSafe for FileChange
impl Send for FileChange
impl Sync for FileChange
impl Unpin for FileChange
impl UnsafeUnpin for FileChange
impl UnwindSafe for FileChange
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
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§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
key and return true if they are equal.