pub trait Executor {
// Required methods
fn block_on(&self, f: Pin<Box<dyn Future<Output = ()>>>);
fn spawn(
&self,
f: Pin<Box<dyn Future<Output = ()> + Send>>,
) -> Box<dyn Task>;
// Provided method
fn spawn_local(
&self,
f: Pin<Box<dyn Future<Output = ()>>>,
) -> Result<Box<dyn Task>, LocalExecutorError> { ... }
}
Expand description
A common interface for spawning futures on top of an executor
Required Methods§
Provided Methods§
Sourcefn spawn_local(
&self,
f: Pin<Box<dyn Future<Output = ()>>>,
) -> Result<Box<dyn Task>, LocalExecutorError>
fn spawn_local( &self, f: Pin<Box<dyn Future<Output = ()>>>, ) -> Result<Box<dyn Task>, LocalExecutorError>
Spawn a non-Send future on the current thread and return a handle to track its completion.