[][src]Trait mobc::Executor

pub trait Executor: Send + Sync + 'static + Clone {
    fn spawn(
        &mut self,
        future: Pin<Box<dyn Future<Output = ()> + Send>>
    ) -> Result<(), SpawnError>; fn status(&self) -> Result<(), SpawnError> { ... } }

A value that executes futures. see tokio::Executor

Required methods

fn spawn(
    &mut self,
    future: Pin<Box<dyn Future<Output = ()> + Send>>
) -> Result<(), SpawnError>

Spawns a future object to run on this executor.

future is passed to the executor, which will begin running it. The future may run on the current thread or another thread at the discretion of the Executor implementation.

Loading content...

Provided methods

fn status(&self) -> Result<(), SpawnError>

Provides a best effort hint to whether or not spawn will succeed.

This function may return both false positives and false negatives. If status returns Ok, then a call to spawn will probably succeed, but may fail. If status returns Err, a call to spawn will probably fail, but may succeed.

This allows a caller to avoid creating the task if the call to spawn has a high likelihood of failing.

Loading content...

Implementors

impl<T> Executor for T where
    T: TkExecutor + Send + Sync + 'static + Clone
[src]

Loading content...