pub trait SharingTracker<D: DagLike> {
// Required methods
fn record(&mut self, object: &D, index: usize) -> Option<usize>;
fn seen_before(&self, object: &D) -> Option<usize>;
}Expand description
How much sharing/expansion to do when running an iterator over a DAG
This object works by recording and looking up nodes in a DAG as they are being iterated over. If the tracker says that an element has been seen before, it will not be yielded again; so for example, a tracker which records nodes by their IHR will implement full sharing, while a tracker which claims to have never seen any node before will implement no sharing at all.
Required Methods§
Sourcefn record(&mut self, object: &D, index: usize) -> Option<usize>
fn record(&mut self, object: &D, index: usize) -> Option<usize>
Marks an object as having been seen, and record the index when it was seen.
If the object was already seen, does not update the index, and instead returns the original one.
Sourcefn seen_before(&self, object: &D) -> Option<usize>
fn seen_before(&self, object: &D) -> Option<usize>
Check whether an object has been seen before; if so, return the index it was recorded at.