Trait microasync_rt::Runtime
source · pub trait Runtime<'a> {
fn push_boxed(
&'a mut self,
future: Pin<Box<dyn Future<Output = ()> + 'static, Global>>
);
fn spawn_boxed(
&'a mut self,
future: Pin<Box<dyn Future<Output = ()> + 'static, Global>>
) -> SpawnedFuture<'a> ⓘ;
fn sleep<'b>(
&'a self,
duration: Duration
) -> Pin<Box<dyn Future<Output = ()> + 'b, Global>>;
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
) -> Pin<Box<dyn Future<Output = ()> + 'b, Global>> { ... }
}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: Pin<Box<dyn Future<Output = ()> + 'static, Global>>
)
fn push_boxed(
&'a mut self,
future: Pin<Box<dyn Future<Output = ()> + 'static, Global>>
)
Adds a new future to the queue to be completed.
sourcefn spawn_boxed(
&'a mut self,
future: Pin<Box<dyn Future<Output = ()> + 'static, Global>>
) -> SpawnedFuture<'a> ⓘ
fn spawn_boxed(
&'a mut self,
future: Pin<Box<dyn Future<Output = ()> + 'static, Global>>
) -> 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.