Struct git_diff::tree::Changes

source ·
pub struct Changes<'a>(_);
Expand description

An iterator over changes of a tree, instantiated using Changes::from(…).

Implementations

Calculate the changes that would need to be applied to self to get other.

  • The state maybe owned or mutably borrowed to allow reuses allocated data structures through multiple runs.
  • locate is a function f(object_id, &mut buffer) -> Option<TreeIter> to return a TreeIter for the given object id backing its data in the given buffer. Returning None is unexpected as these trees are obtained during iteration, and in a typical database errors are not expected either which is why the error case is omitted. To allow proper error reporting, Error::FindExisting should be converted into a more telling error.
  • delegate will receive the computed changes, see the Visit trait for more information on what to expect.
Notes
  • To obtain progress, implement it within the delegate.
  • Tree entries are expected to be ordered using tree-entry-comparison (the same in Rust)
  • it does a breadth first iteration as buffer space only fits two trees, the current one on the one we compare with.
  • does not do rename tracking but attempts to reduce allocations to zero (so performance is mostly determined by the delegate implementation which should be as specific as possible. Rename tracking can be computed on top of the changes received by the delegate.
  • cycle checking is not performed, but can be performed in the delegate which can return tree::visit::Action::Cancel to stop the traversal.
  • std::mem::ManuallyDrop is used because Peekable is needed. When using it as wrapper around our no-drop iterators, all of the sudden borrowcheck complains as Drop is present (even though it’s not)

Trait Implementations

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.