gix_diff::rewrites::tracker

Trait Change

source
pub trait Change: Clone {
    // Required methods
    fn id(&self) -> &oid;
    fn relation(&self) -> Option<Relation>;
    fn kind(&self) -> ChangeKind;
    fn entry_mode(&self) -> EntryMode;
    fn id_and_entry_mode(&self) -> (&oid, EntryMode);
}
Available on crate feature blob only.
Expand description

A trait providing all functionality to abstract over the concept of a change, as seen by the Tracker.

Required Methods§

source

fn id(&self) -> &oid

Return the hash of the object behind this change for identification.

Note that this is the id of the object as stored in git, i.e. it must have gone through workspace conversions. What matters is that the IDs are comparable.

source

fn relation(&self) -> Option<Relation>

Return the relation that this change may have with other changes.

It allows to associate a directory with its children that are added or removed at the same moment. Note that this is ignored for modifications.

If rename-tracking should always be on leaf-level, this should be set to None consistently. Note that trees will never be looked up by their id as their children are assumed to be passed in with the respective relationship.

Also note that the tracker only sees what’s given to it, it will not lookup trees or match paths itself.

source

fn kind(&self) -> ChangeKind

Return the kind of this change.

source

fn entry_mode(&self) -> EntryMode

Return more information about the kind of entry affected by this change.

source

fn id_and_entry_mode(&self) -> (&oid, EntryMode)

Return the id of the change along with its mode.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§