pub struct DiffData {
pub old_path: Option<String>,
pub new_path: Option<String>,
pub hunks: Vec<DiffHunk>,
}Expand description
Complete diff data for one or more files
Fields§
§old_path: Option<String>Path to the old file
new_path: Option<String>Path to the new file
hunks: Vec<DiffHunk>Hunks in the diff
Implementations§
Source§impl DiffData
impl DiffData
Sourcepub fn new(old_path: Option<String>, new_path: Option<String>) -> Self
pub fn new(old_path: Option<String>, new_path: Option<String>) -> Self
Create diff data with paths
Sourcepub fn from_unified_diff(text: &str) -> Self
pub fn from_unified_diff(text: &str) -> Self
Parse a unified diff text into DiffData
Sourcepub fn total_additions(&self) -> usize
pub fn total_additions(&self) -> usize
Get total number of additions across all hunks
Sourcepub fn total_deletions(&self) -> usize
pub fn total_deletions(&self) -> usize
Get total number of deletions across all hunks
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DiffData
impl RefUnwindSafe for DiffData
impl Send for DiffData
impl Sync for DiffData
impl Unpin for DiffData
impl UnwindSafe for DiffData
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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