/// Sends the message  to self, at a specified fixed interval.
/// The message is created each time using a closure `f`.
Sends the message  to self, at a specified fixed interval.
The message is created each time using a closure `f`.
Sends the message to self at a specified fixed interval . The message is created each time using a closure ` f ` .
pub fn send_interval_with<T, F>(&self, f: F, dur: Duration)
    where
        A: Handler<T>,
        F: Fn() -> T + Sync + Send + 'static,
        T: Message<Result = ()>,
    {
        let mut addr = self.addr.clone();
        task::spawn(async move {
            loop {
                task::sleep(dur).await;
                if let Err(_) = addr.send(f()) {
                    break;
                }
            }
        });
    }
pub fn send_interval_with < T , F > ( & self , f : F , dur : Duration ) where A : Handler < T > , F : Fn ( ) -> T + Sync + Send + ' static , T : Message < Result = ( ) > , { let mut addr = self . addr . clone ( ) ; task :: spawn ( async move { loop { task :: sleep ( dur ) . await ; if let Err ( _ ) = addr . send ( f ( ) ) { break ; } } } ) ; }
Sends the message  to self, at a specified fixed interval.
Sends the message to self at a specified fixed interval .
&self
f
F
dur
Duration