spawn_fn

Function spawn_fn 

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

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().