Trait Execute
pub trait Execute:
Send
+ Sync
+ 'static {
// Required method
fn execute(&self, f: Pin<Box<dyn Future<Output = ()> + Send>>);
// Provided methods
fn try_execute(
&self,
f: Pin<Box<dyn Future<Output = ()> + Send>>,
) -> Result<(), Error> { ... }
fn timeout(&self) -> Option<Pin<Box<dyn Future<Output = ()> + Send>>> { ... }
fn sleep(
&self,
_duration: Duration,
) -> Option<Pin<Box<dyn Future<Output = ()> + Send>>> { ... }
}Expand description
Executes background tasks and optionally provides timers.
Required Methods§
Provided Methods§
fn try_execute(
&self,
f: Pin<Box<dyn Future<Output = ()> + Send>>,
) -> Result<(), Error>
fn try_execute( &self, f: Pin<Box<dyn Future<Output = ()> + Send>>, ) -> Result<(), Error>
Submit an async task, returning an error if the executor rejects it. An executor that returns an error must leave the task unpolled.
The default implementation forwards to Self::execute. Executors
with fallible submission should override this method.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".