pub struct FileDiff {
pub old_path: Option<String>,
pub new_path: Option<String>,
pub status: FileStatus,
pub binary: bool,
pub hunks: Vec<Hunk>,
pub additions: u32,
pub deletions: u32,
pub notes: Vec<String>,
}Expand description
One file’s change. old_path/new_path are None where the file does not
exist on that side (added / deleted).
Fields§
§old_path: Option<String>Pre-image path; None for added files.
new_path: Option<String>Post-image path; None for deleted files.
status: FileStatusThe kind of change; determines which of the paths are present.
binary: boolTrue when git reported binary content — such files carry no hunks.
hunks: Vec<Hunk>Textual change hunks, in file order; empty for binary or metadata-only changes.
additions: u32Count of + lines across all hunks; denormalized so consumers need not
re-walk the hunks for totals.
deletions: u32Count of - lines across all hunks; denormalized like additions.
notes: Vec<String>Extended-header notes worth surfacing to a reviewer (mode changes).
Implementations§
Source§impl FileDiff
impl FileDiff
Sourcepub fn display_path(&self) -> String
pub fn display_path(&self) -> String
Human-facing label: old → new for renames, otherwise the path.
Sourcepub fn anchor_path(&self) -> &str
pub fn anchor_path(&self) -> &str
The path comments anchor to: the post-image path when it exists.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FileDiff
impl<'de> Deserialize<'de> for FileDiff
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for FileDiff
impl RefUnwindSafe for FileDiff
impl Send for FileDiff
impl Sync for FileDiff
impl Unpin for FileDiff
impl UnsafeUnpin for FileDiff
impl UnwindSafe for FileDiff
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