Function tk_easyloop::run
[−]
[src]
pub fn run<F: FnOnce() -> R, R: IntoFuture>(f: F) -> Result<R::Item, R::Error>
Run the main loop and initialize it by running a function
This is basically a shortcut for:
let mut lp = Core::new().expect("create loop"); lp.run(futures::lazy(f))
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