pub enum Event<'a, 'old, 'new> {
    Addition {
        entry_mode: EntryMode,
        id: Id<'new>,
    },
    Deletion {
        entry_mode: EntryMode,
        id: Id<'old>,
    },
    Modification {
        previous_entry_mode: EntryMode,
        previous_id: Id<'old>,
        entry_mode: EntryMode,
        id: Id<'new>,
    },
    Rename {
        source_location: &'a BStr,
        source_entry_mode: EntryMode,
        source_id: Id<'old>,
        entry_mode: EntryMode,
        id: Id<'new>,
    },
    Copy {
        source_location: &'a BStr,
        source_entry_mode: EntryMode,
        source_id: Id<'old>,
        entry_mode: EntryMode,
        id: Id<'new>,
    },
}
Expand description

An event emitted when finding differences between two trees.

Variants§

§

Addition

Fields

§entry_mode: EntryMode

The mode of the added entry.

§id: Id<'new>

The object id of the added entry.

An entry was added, like the addition of a file or directory.

§

Deletion

Fields

§entry_mode: EntryMode

The mode of the deleted entry.

§id: Id<'old>

The object id of the deleted entry.

An entry was deleted, like the deletion of a file or directory.

§

Modification

Fields

§previous_entry_mode: EntryMode

The mode of the entry before the modification.

§previous_id: Id<'old>

The object id of the entry before the modification.

§entry_mode: EntryMode

The mode of the entry after the modification.

§id: Id<'new>

The object id after the modification.

An entry was modified, e.g. changing the contents of a file adjusts its object id and turning a file into a symbolic link adjusts its mode.

§

Rename

Fields

§source_location: &'a BStr

The location of the source of the rename operation.

It may be empty if neither file names nor file paths are tracked.

§source_entry_mode: EntryMode

The mode of the entry before the rename.

§source_id: Id<'old>

The object id of the entry before the rename.

Note that this is the same as id if we require the similarity to be 100%, but may be different otherwise.

§entry_mode: EntryMode

The mode of the entry after the rename. It could differ but still be considered a rename as we are concerned only about content.

§id: Id<'new>

The object id after the rename.

Entries are considered renamed if they are not trees and they, according to some understanding of identity, appeared as Deletion in case of the previous source of the rename as well as Addition acting as destination all the while rename tracking is enabled.

Note that mode changes may have occurred as well, i.e. changes from executable to non-executable or vice-versa.

§

Copy

Fields

§source_location: &'a BStr

The location of the source of the copy operation.

It may be empty if neither file names nor file paths are tracked.

§source_entry_mode: EntryMode

The mode of the entry that is considered the source.

§source_id: Id<'old>

The object id of the source of the copy.

Note that this is the same as id if we require the similarity to be 100%, but may be different otherwise.

§entry_mode: EntryMode

The mode of the entry after the copy, or the destination of it. It could differ but still be considered a copy as we are concerned only about content.

§id: Id<'new>

The object id after the copy, or the destination of it.

This entry is considered to be a copy of another, according to some understanding of identity, as its source still exists. If the source wouldn’t exist, it would be considered a rename.

This variant may only occur if rename tracking is enabled, otherwise copies appear to be plain additions.

Implementations§

source§

impl<'a, 'old, 'new> Event<'a, 'old, 'new>

source

pub fn diff(&self) -> Option<Result<Platform<'old, 'new>, Error>>

Produce a platform for performing a line-diff, or None if this is not a Modification or one of the entries to compare is not a blob.

source

pub fn entry_mode(&self) -> EntryMode

Return the current mode of this instance.

Trait Implementations§

source§

impl<'a, 'old, 'new> Clone for Event<'a, 'old, 'new>

source§

fn clone(&self) -> Event<'a, 'old, 'new>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a, 'old, 'new> Debug for Event<'a, 'old, 'new>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, 'old, 'new> Copy for Event<'a, 'old, 'new>

Auto Trait Implementations§

§

impl<'a, 'old, 'new> !RefUnwindSafe for Event<'a, 'old, 'new>

§

impl<'a, 'old, 'new> !Send for Event<'a, 'old, 'new>

§

impl<'a, 'old, 'new> !Sync for Event<'a, 'old, 'new>

§

impl<'a, 'old, 'new> Unpin for Event<'a, 'old, 'new>

§

impl<'a, 'old, 'new> !UnwindSafe for Event<'a, 'old, 'new>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.