run_times 0.1.0

runs a function some number of times
Documentation
//! crate that only bendn will ever use
use std::ops::Range;

mod seal {
    pub trait Seal {}
}
use seal::Seal;

/// Run a function N times
pub trait Run<D = ()>: Seal {
    /// Run it a certain number of times.
    /// ```
    /// # use crate::run::Run;
    /// // twice.
    /// (|| dbg!("ya")).run(2);
    /// ```
    fn run<T: Default>(self, n: T)
    where
        Range<T>: Iterator;
}

impl<D, F: FnMut() -> D> Seal for F {}
impl<D, F: FnMut() -> D + Seal> Run<D> for F {
    fn run<T: Default>(mut self, n: T)
    where
        Range<T>: Iterator,
    {
        (T::default()..n).for_each(|_| drop(self()));
    }
}