pub struct FileDiff {
pub old_path: Option<String>,
pub new_path: String,
pub is_new: bool,
pub is_rename: bool,
pub added: BTreeSet<u32>,
pub removed: BTreeSet<u32>,
/* private fields */
}Expand description
Per-file diff information.
Fields§
§old_path: Option<String>Old-side (base) path. Differs from new_path on a rename; None for an
added file.
new_path: StringNew-side (head) path.
is_new: boolWhether the file is newly added in head.
is_rename: boolWhether the file was renamed (and possibly modified).
added: BTreeSet<u32>New-side line numbers added or modified by the diff.
removed: BTreeSet<u32>Old-side line numbers removed by the diff.
Implementations§
Source§impl FileDiff
impl FileDiff
Sourcepub fn new(
new_path: impl Into<String>,
old_path: Option<String>,
is_new: bool,
is_rename: bool,
added: BTreeSet<u32>,
removed: BTreeSet<u32>,
) -> Self
pub fn new( new_path: impl Into<String>, old_path: Option<String>, is_new: bool, is_rename: bool, added: BTreeSet<u32>, removed: BTreeSet<u32>, ) -> Self
Builds a FileDiff with only added/removed line sets and no hunk
alignment. Used to construct diffs programmatically and in tests; the
git2-driven path uses DiffModel::from_diff which also records hunks.
Sourcepub fn map_base_to_head(&self, old_line: u32) -> Option<u32>
pub fn map_base_to_head(&self, old_line: u32) -> Option<u32>
Maps an unchanged base-side line to its head-side line number.
Returns None when the base line was removed or modified (i.e. it has no
unchanged counterpart in head). Context lines inside hunks use the exact
pairs git2 reported; lines outside every hunk use the cumulative hunk
offset.
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
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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