Skip to content

Commit

Permalink
feat(Bencher): Bencher::iter now accepts unboxed closures
Browse files Browse the repository at this point in the history
cc #38
  • Loading branch information
Jorge Aparicio committed Nov 25, 2014
1 parent 38e83c7 commit b77a7e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub struct Bencher {

impl Bencher {
/// Callback to benchmark a routine
pub fn iter<T>(&mut self, routine: || -> T) {
pub fn iter<T, F: FnMut() -> T>(&mut self, mut routine: F) {
self.ns_start = time::precise_time_ns();
for _ in range(0, self.iters) {
test::black_box(routine());
Expand Down

0 comments on commit b77a7e6

Please sign in to comment.