pub trait Runtime<'a> {
// Required methods
fn push_boxed(&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) -> Stop ⓘ;
// Provided methods
fn push(&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(&mut self, future: BoxFuture<'static, ()>)
fn push_boxed(&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(&mut self, future: impl Future<Output = ()> + 'static)
fn push(&mut self, future: impl Future<Output = ()> + 'static)
Adds a new future to the queue to be completed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".