4 ms·
With async-std, you can just do let future = async_std::task::spawn(timer_future()); And then do more work. The timer_future will run cooperatively, and t
by roblabla 7y ago
With async-std, you can just do
let future = async_std::task::spawn(timer_future());
And then do more work. The timer_future will run cooperatively, and the future returned by spawn is merely a “join handle”.
But this is a feature of the executor, not something that’s part of the core rust async/await. With tokio, you’d have to spawn a separate future and use channels to get the return value.