reth_tasks

Trait TaskSpawnerExt

Source
pub trait TaskSpawnerExt:
    Send
    + Sync
    + Unpin
    + Debug
    + DynClone {
    // Required methods
    fn spawn_critical_with_graceful_shutdown_signal<F>(
        &self,
        name: &'static str,
        f: impl FnOnce(GracefulShutdown) -> F,
    ) -> JoinHandle<()>
       where F: Future<Output = ()> + Send + 'static;
    fn spawn_with_graceful_shutdown_signal<F>(
        &self,
        f: impl FnOnce(GracefulShutdown) -> F,
    ) -> JoinHandle<()>
       where F: Future<Output = ()> + Send + 'static;
}
Expand description

TaskSpawner with extended behaviour

Required Methods§

Source

fn spawn_critical_with_graceful_shutdown_signal<F>( &self, name: &'static str, f: impl FnOnce(GracefulShutdown) -> F, ) -> JoinHandle<()>
where F: Future<Output = ()> + Send + 'static,

This spawns a critical task onto the runtime.

If this task panics, the TaskManager is notified. The TaskManager will wait until the given future has completed before shutting down.

Source

fn spawn_with_graceful_shutdown_signal<F>( &self, f: impl FnOnce(GracefulShutdown) -> F, ) -> JoinHandle<()>
where F: Future<Output = ()> + Send + 'static,

This spawns a regular task onto the runtime.

The TaskManager will wait until the given future has completed before shutting down.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a, T: 'a + TaskSpawnerExt + ?Sized> TaskSpawnerExt for &'a T
where &'a T: Send + Sync + Unpin + Debug + DynClone,

Source§

fn spawn_critical_with_graceful_shutdown_signal<F>( &self, name: &'static str, f: impl FnOnce(GracefulShutdown) -> F, ) -> JoinHandle<()>
where F: Future<Output = ()> + Send + 'static,

Source§

fn spawn_with_graceful_shutdown_signal<F>( &self, f: impl FnOnce(GracefulShutdown) -> F, ) -> JoinHandle<()>
where F: Future<Output = ()> + Send + 'static,

Source§

impl<T: TaskSpawnerExt + ?Sized> TaskSpawnerExt for Arc<T>
where Arc<T>: Send + Sync + Unpin + Debug + DynClone,

Source§

fn spawn_critical_with_graceful_shutdown_signal<F>( &self, name: &'static str, f: impl FnOnce(GracefulShutdown) -> F, ) -> JoinHandle<()>
where F: Future<Output = ()> + Send + 'static,

Source§

fn spawn_with_graceful_shutdown_signal<F>( &self, f: impl FnOnce(GracefulShutdown) -> F, ) -> JoinHandle<()>
where F: Future<Output = ()> + Send + 'static,

Implementors§