Function tk_easyloop::spawn_fn [] [src]

pub fn spawn_fn<F, R>(f: F) where
    F: FnOnce() -> R + 'static,
    R: IntoFuture<Item = (), Error = ()> + 'static, 

Spawn a closure to the current main loop

This only works if running inside the run() function of the main loop

This is an equivalent of:

handle().spawn_fn(f)

Panics

This function panics if there is no currently running loop (i.e. this function is not running from the inside of run().