Function tk_easyloop::run_forever [] [src]

pub fn run_forever<F: FnOnce() -> Result<(), E>, E>(f: F) -> Result<(), E>

Run the main loop and initialize it by running a function, which spawns more futures in the main loop. Then run loop indefinitely.

This is basically a shortcut for:

let mut lp = Core::new().expect("create loop");
lp.run(futures::lazy(f)
       .and_then(|_| empty()))

The difference between run() and run_forever() is merely a convenience. Basically, you want to use run() in client applications when you have a future that should complete to proceed. And run_forever() in server applications which spawns some listeners and never exits.

But also initializes thread-local loop handle for the time of loop run