pub struct FileDiff {
pub old_path: PathBuf,
pub new_path: PathBuf,
pub hunks: Vec<DiffHunk>,
pub is_new_file: bool,
pub is_deleted_file: bool,
pub is_rename: bool,
}Expand description
A complete diff for a single file, containing one or more hunks.
§Examples
use argus_difflens::parser::{parse_unified_diff, FileDiff};
let diff = "diff --git a/hello.rs b/hello.rs\n\
--- a/hello.rs\n\
+++ b/hello.rs\n\
@@ -1,3 +1,4 @@\n\
fn main() {\n\
+ println!(\"hello\");\n\
}\n";
let files = parse_unified_diff(diff).unwrap();
assert_eq!(files.len(), 1);
assert_eq!(files[0].hunks.len(), 1);Fields§
§old_path: PathBufPath in the old version.
new_path: PathBufPath in the new version.
hunks: Vec<DiffHunk>Parsed hunks for this file.
is_new_file: boolWhether this is a newly created file.
is_deleted_file: boolWhether this file was deleted.
is_rename: boolWhether this file was renamed.
Trait Implementations§
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