Trait reth::tasks::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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a, T> TaskSpawnerExt for &'a T
where T: 'a + TaskSpawnerExt + ?Sized, &'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 for Arc<T>
where T: TaskSpawnerExt + ?Sized, 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§