pub enum ChangeRef<'lhs, 'rhs> {
Addition {
location: Cow<'rhs, BStr>,
index: usize,
entry_mode: Mode,
id: Cow<'rhs, oid>,
},
Deletion {
location: Cow<'lhs, BStr>,
index: usize,
entry_mode: Mode,
id: Cow<'rhs, oid>,
},
Modification {
location: Cow<'rhs, BStr>,
previous_index: usize,
previous_entry_mode: Mode,
previous_id: Cow<'lhs, oid>,
index: usize,
entry_mode: Mode,
id: Cow<'rhs, oid>,
},
Rewrite {
source_location: Cow<'lhs, BStr>,
source_index: usize,
source_entry_mode: Mode,
source_id: Cow<'lhs, oid>,
location: Cow<'rhs, BStr>,
index: usize,
entry_mode: Mode,
id: Cow<'rhs, oid>,
copy: bool,
},
}
index
only.Expand description
Identify a change that would have to be applied to lhs
to obtain rhs
, as provided in index()
.
Variants§
Addition
An entry was added to rhs
.
Fields
Deletion
An entry was removed from rhs
.
Fields
Modification
An entry was modified, i.e. has changed its content or its mode.
Fields
Rewrite
An entry was renamed or copied from lhs
to rhs
.
A rename is effectively fusing together the Deletion
of the source and the Addition
of the destination.
Fields
source_location: Cow<'lhs, BStr>
The location of the source of the rename or copy operation, in lhs
.
source_index: usize
The index of the entry before the rename, into the entries array of rhs
for full access.
source_id: Cow<'lhs, oid>
The object id of the entry before the rewrite.
Note that this is the same as id
if we require the similarity to be 100%, but may
be different otherwise.
Implementations§
Source§impl ChangeRef<'_, '_>
impl ChangeRef<'_, '_>
Sourcepub fn into_owned(self) -> Change
pub fn into_owned(self) -> Change
Copy everything into an owned version of this instance.
Source§impl ChangeRef<'_, '_>
impl ChangeRef<'_, '_>
Sourcepub fn fields(&self) -> (&BStr, usize, Mode, &oid)
pub fn fields(&self) -> (&BStr, usize, Mode, &oid)
Return all shared fields among all variants: (location, index, entry_mode, id)
In case of rewrites, the fields return to the current change.
Note that there are also more specific accessors in case you only need to access to one of these fields individually.
See ChangeRef::location()
, ChangeRef::index()
, ChangeRef::entry_mode()
and
ChangeRef::id()
.
Sourcepub fn location(&self) -> &BStr
pub fn location(&self) -> &BStr
Return the location
, in the case of rewrites referring to the current change.
Sourcepub fn index(&self) -> usize
pub fn index(&self) -> usize
Return the index
, in the case of rewrites referring to the current change.
Sourcepub fn entry_mode(&self) -> Mode
pub fn entry_mode(&self) -> Mode
Return the entry_mode
, in the case of rewrites referring to the current change.
Trait Implementations§
Source§impl Change for ChangeRef<'_, '_>
impl Change for ChangeRef<'_, '_>
Source§fn id(&self) -> &oid
fn id(&self) -> &oid
blob
only.Source§fn relation(&self) -> Option<Relation>
fn relation(&self) -> Option<Relation>
blob
only.Source§fn kind(&self) -> ChangeKind
fn kind(&self) -> ChangeKind
blob
only.Source§fn entry_mode(&self) -> EntryMode
fn entry_mode(&self) -> EntryMode
blob
only.Source§fn id_and_entry_mode(&self) -> (&oid, EntryMode)
fn id_and_entry_mode(&self) -> (&oid, EntryMode)
blob
only.impl<'lhs, 'rhs> Eq for ChangeRef<'lhs, 'rhs>
impl<'lhs, 'rhs> StructuralPartialEq for ChangeRef<'lhs, 'rhs>
Auto Trait Implementations§
impl<'lhs, 'rhs> Freeze for ChangeRef<'lhs, 'rhs>
impl<'lhs, 'rhs> RefUnwindSafe for ChangeRef<'lhs, 'rhs>
impl<'lhs, 'rhs> Send for ChangeRef<'lhs, 'rhs>
impl<'lhs, 'rhs> Sync for ChangeRef<'lhs, 'rhs>
impl<'lhs, 'rhs> Unpin for ChangeRef<'lhs, 'rhs>
impl<'lhs, 'rhs> UnwindSafe for ChangeRef<'lhs, 'rhs>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.