Function gix_traverse::tree::breadthfirst

source ยท
pub fn breadthfirst<StateMut, Find, V>(
    root: TreeRefIter<'_>,
    state: StateMut,
    objects: Find,
    delegate: &mut V,
) -> Result<(), Error>
where Find: Find, StateMut: BorrowMut<State>, V: Visit,
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 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 is Option<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. Hence Error::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.