Top N Set
This crate provides a topset which selects a given number of greatest items. The criterium used to sort the items could be specified as a closure. It is based internally on a binary heap with a fixed size.
The struct TopSet
could be used directly or through the trait TopSetReducing
which automatically extend the iterator trait.
Note: the returned items are unsorted.
use TopIter;
will produce (possibly in a different order):
in the top 4: 7
in the top 4: 8
in the top 4: 9
in the top 4: 8
in the last 4: 4
in the last 4: 3
in the last 4: 1
in the last 4: 2