pub trait BlockHashIteratorExtensions: Iterator<Item = Hash> {
// Provided method
fn block_unique(self) -> BlockUnique<Self> ⓘ
where Self: Sized { ... }
}Provided Methods§
Sourcefn block_unique(self) -> BlockUnique<Self> ⓘwhere
Self: Sized,
fn block_unique(self) -> BlockUnique<Self> ⓘwhere
Self: Sized,
Copy of itertools::unique, adapted for block hashes (uses BlockHashSet under the hood)
Returns an iterator adaptor that filters out hashes that have already been produced once during the iteration.
Clones of visited elements are stored in a hash set in the iterator.
The iterator is stable, returning the non-duplicate items in the order in which they occur in the adapted iterator. In a set of duplicate items, the first item encountered is the item retained.
NOTE: currently usages are expected to contain no duplicates, hence we alloc the expected capacity