Trait tiny_bench::Timeable
source · pub trait Timeable<It, T>: Sizedwhere
It: Iterator<Item = T>,{
// Required methods
fn timed_labeled(
self,
label: &'static str,
) -> TimedIterator<It, T, SimpleStdout> ⓘ;
fn timed_persisted_labeled(
self,
label: &'static str,
) -> TimedIterator<It, T, ComparedStdout> ⓘ;
// Provided methods
fn timed(self) -> TimedIterator<It, T, SimpleStdout> ⓘ { ... }
fn timed_persisted(self) -> TimedIterator<It, T, ComparedStdout> ⓘ { ... }
}
Expand description
A trait for allowing iterators to be used as timers
Required Methods§
sourcefn timed_labeled(
self,
label: &'static str,
) -> TimedIterator<It, T, SimpleStdout> ⓘ
fn timed_labeled( self, label: &'static str, ) -> TimedIterator<It, T, SimpleStdout> ⓘ
Time this iterator with a specified label
use tiny_bench::Timeable;
let v: Vec<i32> = (0..100)
.timed_labeled("my_iterator_test")
.collect();
// Prints results when the iterator has been drained
assert_eq!(100, v.len());
sourcefn timed_persisted_labeled(
self,
label: &'static str,
) -> TimedIterator<It, T, ComparedStdout> ⓘ
fn timed_persisted_labeled( self, label: &'static str, ) -> TimedIterator<It, T, ComparedStdout> ⓘ
Time this iterator with a custom label to separate different runs for comparison
Provided Methods§
sourcefn timed(self) -> TimedIterator<It, T, SimpleStdout> ⓘ
fn timed(self) -> TimedIterator<It, T, SimpleStdout> ⓘ
Time this iterator with an anonymous label
use tiny_bench::Timeable;
let v: Vec<i32> = (0..100)
.timed()
.collect();
// Prints results when the iterator has been drained
assert_eq!(100, v.len());
sourcefn timed_persisted(self) -> TimedIterator<It, T, ComparedStdout> ⓘ
fn timed_persisted(self) -> TimedIterator<It, T, ComparedStdout> ⓘ
Time this iterator with an anonymous label and persist the result so that other anonymous time results will be compared with it when they run next
Object Safety§
This trait is not object safe.