Function git_traverse::tree::breadthfirst::traverse [−][src]
pub fn traverse<StateMut, Find, V>(
root: impl Into<ObjectId>,
state: StateMut,
find: Find,
delegate: &mut V
) -> Result<(), Error> where
Find: for<'a> FnMut(&oid, &'a mut Vec<u8>) -> Option<TreeIter<'a>>,
StateMut: BorrowMut<State<V::PathId>>,
V: Visit,
Start a breadth-first iteration over the root trees entries.
root- the starting points of the iteration
- each commit they lead to will only be returned once, including the tip that started it
state- all state used for the iteration. If multiple iterations are performed, allocations can be minimized by reusing this state.find- a way to lookup new object data during traversal by their ObjectId, writing their data into buffer and returning an iterator over entries if the object is present and is a tree. Caching should be implemented within this function as needed. The return value isOption<TreeIter>which degenerates all error information. Not finding a commit should also be considered an errors as all objects in the tree DAG should be present in the database. HenceError::NotFoundshould be escalated into a more specific error if its encountered by the caller.delegate- A way to observe entries and control the iteration while allowing the optimizer to let you pay only for what you use.