wait

Trait Waitable

Source
pub trait Waitable {
    type Output;

    // Required method
    fn wait(self) -> Self::Output
       where Self: Sized;
}
Expand description

The Waitable trait defines a method that is implemented for all Future types. This allows you to call the .wait() method on any Future outside of an async context.

Required Associated Types§

Required Methods§

Source

fn wait(self) -> Self::Output
where Self: Sized,

Implementors§

Source§

impl<F> Waitable for F
where F: Future,

This is the implementation of the Waitable trait for every Future. All async functions return a Future, so this attaches the .wait() method to every async function.

All it does is put the thread to sleep until the Future is ready to return a value.