Trait async_core::Runtime
source · pub trait Runtime<'a> {
fn push_boxed(&'a mut self, future: BoxFuture<'static, ()>);
fn spawn_boxed(
&'a mut self,
future: BoxFuture<'static, ()>
) -> SpawnedFuture<'a> ⓘ;
fn sleep<'b>(&'a self, duration: Duration) -> BoxFuture<'b, ()>;
fn stop(&mut self);
fn push(&'a mut self, future: impl Future<Output = ()> + 'static) { ... }
fn spawn(
&'a mut self,
future: impl Future<Output = ()> + 'static
) -> SpawnedFuture<'a> ⓘ { ... }
fn sleep_ms<'b>(&'a self, amount: u64) -> BoxFuture<'b, ()> { ... }
}
Expand description
Auto-trait with the methods that will actually be called by the users of the runtime.
Required Methods§
sourcefn push_boxed(&'a mut self, future: BoxFuture<'static, ()>)
fn push_boxed(&'a mut self, future: BoxFuture<'static, ()>)
Adds a new future to the queue to be completed.
sourcefn spawn_boxed(&'a mut self, future: BoxFuture<'static, ()>) -> SpawnedFuture<'a> ⓘ
fn spawn_boxed(&'a mut self, future: BoxFuture<'static, ()>) -> SpawnedFuture<'a> ⓘ
Adds a new future to the queue to be completed and returns a future waiting for the added future’s completion.
Provided Methods§
sourcefn push(&'a mut self, future: impl Future<Output = ()> + 'static)
fn push(&'a mut self, future: impl Future<Output = ()> + 'static)
Adds a new future to the queue to be completed.