pub trait RuntimeDriver: Clone + 'static {
// Required methods
fn now(&self) -> Duration;
fn sleep_until(&self, deadline: Duration) -> LocalBoxFuture<'static, ()>;
fn yield_now(&self) -> LocalBoxFuture<'static, ()>;
fn spawn_local(&self, task: LocalTask) -> Result<DriverTask, SpawnError>;
fn shutdown_requested(&self) -> bool;
// Provided methods
fn wait_for_runtime_event(
&self,
_deadline: Duration,
) -> LocalBoxFuture<'static, ()> { ... }
fn jitter(&self, _maximum: Duration) -> Duration { ... }
}Expand description
Host facilities required to advance the portable Kernel.
Required Methods§
Sourcefn sleep_until(&self, deadline: Duration) -> LocalBoxFuture<'static, ()>
fn sleep_until(&self, deadline: Duration) -> LocalBoxFuture<'static, ()>
Waits until the supplied monotonic instant.
Sourcefn yield_now(&self) -> LocalBoxFuture<'static, ()>
fn yield_now(&self) -> LocalBoxFuture<'static, ()>
Cooperatively yields to other work on the local task lane.
Sourcefn spawn_local(&self, task: LocalTask) -> Result<DriverTask, SpawnError>
fn spawn_local(&self, task: LocalTask) -> Result<DriverTask, SpawnError>
Schedules Kernel-owned work on the local task lane.
Sourcefn shutdown_requested(&self) -> bool
fn shutdown_requested(&self) -> bool
Reports whether the embedding Runner requested shutdown.
Provided Methods§
Sourcefn wait_for_runtime_event(
&self,
_deadline: Duration,
) -> LocalBoxFuture<'static, ()>
fn wait_for_runtime_event( &self, _deadline: Duration, ) -> LocalBoxFuture<'static, ()>
Waits for Runner control work or until the supplied monotonic instant.
Drivers with an event source should override this to park the lane. The yielding default preserves compatibility with deterministic and embedded Drivers that advance work cooperatively.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".