Struct git_diff::tree::Changes[][src]

pub struct Changes<'a>(_);

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

Implementations

impl<'a> Changes<'a>[src]

pub fn needed_to_obtain<LocateFn, R, StateMut>(
    self,
    other: TreeIter<'a>,
    state: StateMut,
    locate: LocateFn,
    delegate: &mut R
) -> Result<(), Error> where
    LocateFn: for<'b> FnMut(&oid, &'b mut Vec<u8>) -> Option<TreeIter<'b>>,
    R: Visit,
    StateMut: BorrowMut<State<R::PathId>>, 
[src]

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::NotFound 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

impl<'a, T> From<T> for Changes<'a> where
    T: Into<Option<TreeIter<'a>>>, 
[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Changes<'a>

impl<'a> Send for Changes<'a>

impl<'a> Sync for Changes<'a>

impl<'a> Unpin for Changes<'a>

impl<'a> UnwindSafe for Changes<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.