Struct radicle_surf::diff::Diff
source · pub struct Diff { /* private fields */ }
Expand description
The serializable representation of a git diff
.
A Diff
can be retrieved by the following functions:
Implementations§
source§impl Diff
impl Diff
sourcepub fn files(&self) -> impl Iterator<Item = &FileDiff>
pub fn files(&self) -> impl Iterator<Item = &FileDiff>
Returns an iterator of the file in the diff.
sourcepub fn into_files(self) -> Vec<FileDiff>
pub fn into_files(self) -> Vec<FileDiff>
Returns owned files in the diff.
sourcepub fn added(&self) -> impl Iterator<Item = &Added>
pub fn added(&self) -> impl Iterator<Item = &Added>
Examples found in repository?
examples/diff.rs (line 60)
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
fn print_diff_summary(diff: &Diff, elapsed_nanos: u128) {
diff.added().for_each(|created| {
println!("+++ {:?}", created.path);
});
diff.deleted().for_each(|deleted| {
println!("--- {:?}", deleted.path);
});
diff.modified().for_each(|modified| {
println!("mod {:?}", modified.path);
});
println!(
"created {} / deleted {} / modified {} / total {}",
diff.added().count(),
diff.deleted().count(),
diff.modified().count(),
diff.added().count() + diff.deleted().count() + diff.modified().count()
);
println!("diff took {elapsed_nanos} nanos ");
}
sourcepub fn deleted(&self) -> impl Iterator<Item = &Deleted>
pub fn deleted(&self) -> impl Iterator<Item = &Deleted>
Examples found in repository?
examples/diff.rs (line 63)
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
fn print_diff_summary(diff: &Diff, elapsed_nanos: u128) {
diff.added().for_each(|created| {
println!("+++ {:?}", created.path);
});
diff.deleted().for_each(|deleted| {
println!("--- {:?}", deleted.path);
});
diff.modified().for_each(|modified| {
println!("mod {:?}", modified.path);
});
println!(
"created {} / deleted {} / modified {} / total {}",
diff.added().count(),
diff.deleted().count(),
diff.modified().count(),
diff.added().count() + diff.deleted().count() + diff.modified().count()
);
println!("diff took {elapsed_nanos} nanos ");
}
pub fn moved(&self) -> impl Iterator<Item = &Moved>
sourcepub fn modified(&self) -> impl Iterator<Item = &Modified>
pub fn modified(&self) -> impl Iterator<Item = &Modified>
Examples found in repository?
examples/diff.rs (line 66)
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
fn print_diff_summary(diff: &Diff, elapsed_nanos: u128) {
diff.added().for_each(|created| {
println!("+++ {:?}", created.path);
});
diff.deleted().for_each(|deleted| {
println!("--- {:?}", deleted.path);
});
diff.modified().for_each(|modified| {
println!("mod {:?}", modified.path);
});
println!(
"created {} / deleted {} / modified {} / total {}",
diff.added().count(),
diff.deleted().count(),
diff.modified().count(),
diff.added().count() + diff.deleted().count() + diff.modified().count()
);
println!("diff took {elapsed_nanos} nanos ");
}
pub fn copied(&self) -> impl Iterator<Item = &Copied>
pub fn stats(&self) -> &Stats
pub fn insert_modified( &mut self, path: PathBuf, diff: DiffContent, old: DiffFile, new: DiffFile, )
pub fn insert_moved( &mut self, old_path: PathBuf, new_path: PathBuf, old: DiffFile, new: DiffFile, content: DiffContent, )
pub fn insert_copied( &mut self, old_path: PathBuf, new_path: PathBuf, old: DiffFile, new: DiffFile, content: DiffContent, )
pub fn insert_added(&mut self, path: PathBuf, diff: DiffContent, new: DiffFile)
pub fn insert_deleted( &mut self, path: PathBuf, diff: DiffContent, old: DiffFile, )
Trait Implementations§
impl Eq for Diff
impl StructuralPartialEq for Diff
Auto Trait Implementations§
impl Freeze for Diff
impl RefUnwindSafe for Diff
impl Send for Diff
impl Sync for Diff
impl Unpin for Diff
impl UnwindSafe for Diff
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)