pub fn interval(&self, duration: Duration) -> Interval {
        match &self.inner {
            #[cfg(feature = "tokio_executor")]
            TokioHandle(_) => {
                use std::ops::Add;
                let at = tokio::time::Instant::now().add(duration);
                // This is needed because by default tokio intervals fire immediately
                Interval(IntervalInner::Tokio(tokio::time::interval_at(at, duration)))
            },
            #[cfg(feature = "async_std_executor")]
            AsyncStdHandle => {
                Interval(IntervalInner::AsyncStd(async_std::stream::interval(duration)))
            }, 
            #[cfg(feature = "smol_executor")]
            SmolHandle(_) => {
                use std::ops::Add;
                let at = std::time::Instant::now().add(duration);
                let timer = std::cell::Cell::new(async_io::Timer::at(at));
                Interval(IntervalInner::Smol(timer, duration, at))
            },
            #[cfg(feature = "futures_executor")]
            FuturesHandle(_) => {
                Interval(IntervalInner::AsyncTimer(async_timer::interval(duration)))
            },
            #[cfg(feature = "wasm_bindgen_executor")]
            WasmBindgenHandle => {
                Interval(IntervalInner::WasmBindgen(WasmInterval::new(duration)))
            }
        }        
    }
/// Creates a new Interval for a given duration.
Creates a new Interval for a given duration.
Creates a new Interval for a given duration .
pub fn interval(&self, duration: Duration) -> Interval {
        match &self.inner {
            #[cfg(feature = "tokio_executor")]
            TokioHandle(_) => {
                use std::ops::Add;
                let at = tokio::time::Instant::now().add(duration);
                // This is needed because by default tokio intervals fire immediately
                Interval(IntervalInner::Tokio(tokio::time::interval_at(at, duration)))
            },
            #[cfg(feature = "async_std_executor")]
            AsyncStdHandle => {
                Interval(IntervalInner::AsyncStd(async_std::stream::interval(duration)))
            }, 
            #[cfg(feature = "smol_executor")]
            SmolHandle(_) => {
                use std::ops::Add;
                let at = std::time::Instant::now().add(duration);
                let timer = std::cell::Cell::new(async_io::Timer::at(at));
                Interval(IntervalInner::Smol(timer, duration, at))
            },
            #[cfg(feature = "futures_executor")]
            FuturesHandle(_) => {
                Interval(IntervalInner::AsyncTimer(async_timer::interval(duration)))
            },
            #[cfg(feature = "wasm_bindgen_executor")]
            WasmBindgenHandle => {
                Interval(IntervalInner::WasmBindgen(WasmInterval::new(duration)))
            }
        }        
    }
pub fn interval ( & self , duration : Duration ) -> Interval { match & self . inner { # [ cfg ( feature " " ) ] TokioHandle ( _ ) => { use std :: ops :: Add ; let at = tokio :: time :: Instant :: now ( ) . add ( duration ) ; // This is needed because by default tokio intervals fire immediately Interval ( IntervalInner :: Tokio ( tokio :: time :: interval_at ( at , duration ) ) ) } , # [ cfg ( feature " " ) ] AsyncStdHandle => { Interval ( IntervalInner :: AsyncStd ( async_std :: stream :: interval ( duration ) ) ) } , # [ cfg ( feature " " ) ] SmolHandle ( _ ) => { use std :: ops :: Add ; let at = std :: time :: Instant :: now ( ) . add ( duration ) ; let timer = std :: cell :: Cell :: new ( async_io :: Timer :: at ( at ) ) ; Interval ( IntervalInner :: Smol ( timer , duration , at ) ) } , # [ cfg ( feature " " ) ] FuturesHandle ( _ ) => { Interval ( IntervalInner :: AsyncTimer ( async_timer :: interval ( duration ) ) ) } , # [ cfg ( feature " " ) ] WasmBindgenHandle => { Interval ( IntervalInner :: WasmBindgen ( WasmInterval :: new ( duration ) ) ) } } }
Creates a new Interval for a given duration.
Creates a new Interval for a given duration .
&self
duration
Duration