| @@ -5,7 +5,7 @@ use quick_error::quick_error; · 4 unmodified lines |
| 5 | 5 | use std::{borrow::BorrowMut, collections::VecDeque}; |
| 6 | 6 | |
| 7 | 7 | quick_error! { |
| 8 | | − /// The error is part of the item returned by the [breadthfirst] function. |
| 8 | + /// The error is part of the item returned by the [`traverse()`] function. |
| 9 | 9 | #[derive(Debug)] |
| 10 | 10 | #[allow(missing_docs)] |
| 11 | 11 | pub enum Error { |
| @@ -37,18 +37,19 @@ impl<PathId: Clone> State<PathId> { · 25 unmodified lines |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | | −/// Create a new instance. |
| 40 | +/// Start a breadth-first iteration over the `root` trees entries. |
| 41 | 41 | /// |
| 42 | +/// * `root` |
| 43 | +/// * the starting points of the iteration |
| 44 | +/// * each commit they lead to will only be returned once, including the tip that started it |
| 45 | +/// * `state` - all state used for the iteration. If multiple iterations are performed, allocations can be minimized by reusing |
| 46 | +/// this state. |
| 42 | 47 | /// * `find` - a way to lookup new object data during traversal by their ObjectId, writing their data into buffer and returning |
| 43 | 48 | /// an iterator over entries if the object is present and is a tree. Caching should be implemented within this function |
| 44 | 49 | /// as needed. The return value is `Option<TreeIter>` which degenerates all error information. Not finding a commit should also |
| 45 | 50 | /// be considered an errors as all objects in the tree DAG should be present in the database. Hence [`Error::NotFound`] should |
| 46 | 51 | /// be escalated into a more specific error if its encountered by the caller. |
| 47 | | −/// * `state` - all state used for the iteration. If multiple iterations are performed, allocations can be minimized by reusing |
| 48 | | −/// this state. |
| 49 | | −/// * `root` |
| 50 | | −/// * the starting points of the iteration |
| 51 | | −/// * each commit they lead to will only be returned once, including the tip that started it |
| 52 | +/// * `delegate` - A way to observe entries and control the iteration while allowing the optimizer to let you pay only for what you use. |
| 52 | 53 | pub fn traverse<StateMut, Find, V>( |
| 53 | 54 | root: impl Into<ObjectId>, |
| 54 | 55 | mut state: StateMut, |