pub struct Bencher { /* private fields */ }
Implementations§
Source§impl Bencher
impl Bencher
pub fn new() -> Self
Sourcepub fn set_iterations(&mut self, iterations: usize) -> &mut Self
pub fn set_iterations(&mut self, iterations: usize) -> &mut Self
Sets the number of iterations a benchmark will be run If set to 0 it iterates until the standard deviation is below 1%
pub fn set_max_iterations(&mut self, iterations: usize) -> &mut Self
Sourcepub fn bench<T, F: FnMut() -> T>(&mut self, name: &str, func: F) -> &mut Self
pub fn bench<T, F: FnMut() -> T>(&mut self, name: &str, func: F) -> &mut Self
Benchmarks a closure a configured number of times. The result will be printed to the console with the given name.
Sourcepub fn compare(&mut self) -> &mut Self
pub fn compare(&mut self) -> &mut Self
Compares the last two benchmarks If the number of benchmarks is below 2 it doesn’t do anything
Sourcepub fn print_settings(&mut self) -> &mut Self
pub fn print_settings(&mut self) -> &mut Self
Prints the settings of the Bencher
Sourcepub fn write_output_to(&mut self, writer: BufWriter<File>) -> &mut Self
pub fn write_output_to(&mut self, writer: BufWriter<File>) -> &mut Self
Adds a file to write the output to
pub fn flush(&mut self) -> Result<()>
Auto Trait Implementations§
impl Freeze for Bencher
impl RefUnwindSafe for Bencher
impl Send for Bencher
impl Sync for Bencher
impl Unpin for Bencher
impl UnwindSafe for Bencher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more