Skip to main content

diff_trees_visit

Function diff_trees_visit 

Source
pub fn diff_trees_visit<S, V, B>(
    store: &S,
    from: &ContentHash,
    to: &ContentHash,
    visitor: V,
) -> Result<ControlFlow<B>, Error>
where S: ObjectStore + ?Sized, V: FnMut(FileChange) -> ControlFlow<B>,
Expand description

Diff two trees with internal iteration, invoking visitor for each FileChange in traversal order.

This is the streaming counterpart to diff_trees. The visitor returns a ControlFlow: Continue(()) keeps walking, while Break(value) stops the traversal immediately — no further subtrees are loaded and no further changes are produced. Early-exit consumers (e.g. “does anything under path X differ?”, first-N, quick-status checks) use this to avoid materializing the entire change list.

On early exit the carried B is returned as Ok(ControlFlow::Break(b)); on full completion it returns Ok(ControlFlow::Continue(())). Changes are emitted in exactly the same order as diff_trees collects them, so the two paths are behavior-identical.