Function gix_traverse::tree::breadthfirst
source · pub fn breadthfirst<StateMut, Find, V>(
root: TreeRefIter<'_>,
state: StateMut,
objects: Find,
delegate: &mut V
) -> Result<(), Error>
Expand description
Start a breadth-first iteration over the root
trees entries.
root
- the tree to iterate in a nested fashion.
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 theirObjectId
, 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::Find
should 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.