Skip to main content

ExecutorTimeout

Trait ExecutorTimeout 

Source
pub trait ExecutorTimeout: Executor {
    // Provided methods
    fn spawn_timeout<F>(
        &self,
        duration: Duration,
        f: F,
    ) -> JoinHandle<Result<F::Output, TimeoutError>> 
       where F: Future + Send + 'static,
             F::Output: Send + 'static { ... }
    fn spawn_delay<F>(&self, duration: Duration, f: F) -> JoinHandle<F::Output> 
       where F: Future + Send + 'static,
             F::Output: Send + 'static { ... }
    fn spawn_abortable_timeout<F>(
        &self,
        duration: Duration,
        f: F,
    ) -> AbortableJoinHandle<Result<F::Output, TimeoutError>> 
       where F: Future + Send + 'static,
             F::Output: Send + 'static { ... }
    fn spawn_abortable_delay<F>(
        &self,
        duration: Duration,
        f: F,
    ) -> AbortableJoinHandle<F::Output> 
       where F: Future + Send + 'static,
             F::Output: Send + 'static { ... }
}

Provided Methods§

Source

fn spawn_timeout<F>( &self, duration: Duration, f: F, ) -> JoinHandle<Result<F::Output, TimeoutError>>
where F: Future + Send + 'static, F::Output: Send + 'static,

Spawns a new asynchronous task in the background that must complete within duration, returning a JoinHandle.

If the future does not finish before duration elapses, it is dropped and the task completes with TimeoutError.

Source

fn spawn_delay<F>(&self, duration: Duration, f: F) -> JoinHandle<F::Output>
where F: Future + Send + 'static, F::Output: Send + 'static,

Spawns a task after waiting for a duration before the task is polled.

Source

fn spawn_abortable_timeout<F>( &self, duration: Duration, f: F, ) -> AbortableJoinHandle<Result<F::Output, TimeoutError>>
where F: Future + Send + 'static, F::Output: Send + 'static,

Spawns a new asynchronous task in the background that must complete within duration, returning an abortable handle that will cancel the task once the handle is dropped.

If the future does not finish before duration elapses, it is dropped and the task completes with TimeoutError.

Source

fn spawn_abortable_delay<F>( &self, duration: Duration, f: F, ) -> AbortableJoinHandle<F::Output>
where F: Future + Send + 'static, F::Output: Send + 'static,

Spawns an abortable task after waiting for duration before the task is polled.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<E> ExecutorTimeout for Arc<E>
where E: ExecutorTimeout,

Source§

fn spawn_timeout<F>( &self, duration: Duration, f: F, ) -> JoinHandle<Result<F::Output, TimeoutError>>
where F: Future + Send + 'static, F::Output: Send + 'static,

Source§

fn spawn_delay<F>(&self, duration: Duration, f: F) -> JoinHandle<F::Output>
where F: Future + Send + 'static, F::Output: Send + 'static,

Source§

fn spawn_abortable_timeout<F>( &self, duration: Duration, f: F, ) -> AbortableJoinHandle<Result<F::Output, TimeoutError>>
where F: Future + Send + 'static, F::Output: Send + 'static,

Source§

fn spawn_abortable_delay<F>( &self, duration: Duration, f: F, ) -> AbortableJoinHandle<F::Output>
where F: Future + Send + 'static, F::Output: Send + 'static,

Source§

impl<E> ExecutorTimeout for Rc<E>
where E: ExecutorTimeout,

Source§

fn spawn_timeout<F>( &self, duration: Duration, f: F, ) -> JoinHandle<Result<F::Output, TimeoutError>>
where F: Future + Send + 'static, F::Output: Send + 'static,

Source§

fn spawn_delay<F>(&self, duration: Duration, f: F) -> JoinHandle<F::Output>
where F: Future + Send + 'static, F::Output: Send + 'static,

Source§

fn spawn_abortable_timeout<F>( &self, duration: Duration, f: F, ) -> AbortableJoinHandle<Result<F::Output, TimeoutError>>
where F: Future + Send + 'static, F::Output: Send + 'static,

Source§

fn spawn_abortable_delay<F>( &self, duration: Duration, f: F, ) -> AbortableJoinHandle<F::Output>
where F: Future + Send + 'static, F::Output: Send + 'static,

Implementors§