pub trait Runtime:
Send
+ Sync
+ Debug
+ 'static {
// Required methods
fn spawn(&self, task: BoxFuture<()>);
fn sleep(&self, duration: Duration) -> BoxFuture<()>;
fn now(&self) -> Instant;
// Provided method
fn sleep_until(&self, deadline: Instant) -> BoxFuture<()> { ... }
}Expand description
What a polyoxide crate needs of an async runtime: a detached spawn, a
sleep, and a monotonic clock. Everything else in this crate (spawn’s
Task, timeout, Interval) is built on these, so an implementor writes
only these.
A client takes its runtime from its builder, and falls back to
default_runtime(); nothing is process-wide.
Required Methods§
Provided Methods§
Sourcefn sleep_until(&self, deadline: Instant) -> BoxFuture<()>
fn sleep_until(&self, deadline: Instant) -> BoxFuture<()>
Complete at deadline, at once when it has passed.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".