reth::tasks

Trait TaskSpawnerExt

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§

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.

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§

§

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

§

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,

§

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

§

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,

Implementors§