pub trait Executor:
Send
+ Sync
+ 'static {
// Required methods
fn spawn(&self, name: &'static str, job: Job) -> Result<(), Unsupported>;
fn wake_at(&self, deadline: Instant, wake: WakeHandle);
fn park(&self, deadline: Instant);
// Provided method
fn now(&self) -> Instant { ... }
}Required Methods§
Sourcefn spawn(&self, name: &'static str, job: Job) -> Result<(), Unsupported>
fn spawn(&self, name: &'static str, job: Job) -> Result<(), Unsupported>
Run job off the calling thread. name identifies the work in logs.
Implementations must not run job before returning: callers may hold
locks the job also takes.
§Errors
Returns Unsupported when this host cannot run background work.
fn wake_at(&self, deadline: Instant, wake: WakeHandle)
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".