HandleExt

Trait HandleExt 

Source
pub trait HandleExt<T> {
    // Required methods
    fn spawn_traced<F>(&self, f: F) -> JoinHandle<T>
       where F: Future<Output = T> + Send + 'static,
             T: Send + 'static;
    fn spawn_traced_named<S, F>(&self, name: S, f: F) -> JoinHandle<T>
       where S: Into<String>,
             F: Future<Output = T> + Send + 'static,
             T: Send + 'static;
}
Expand description

Helper trait for providing traced spawning when using Handle.

Required Methods§

Source

fn spawn_traced<F>(&self, f: F) -> JoinHandle<T>
where F: Future<Output = T> + Send + 'static, T: Send + 'static,

Spawns a new asynchronous task, returning a JoinHandle for it.

This is meant to be a thin wrapper over task management types like Handle, and provides implicit “tracing” for spawned futures by ensuring that the task is attached to the current tracing span and the current allocation component.

Source

fn spawn_traced_named<S, F>(&self, name: S, f: F) -> JoinHandle<T>
where S: Into<String>, F: Future<Output = T> + Send + 'static, T: Send + 'static,

Spawns a new named asynchronous task, returning a JoinHandle for it.

This is meant to be a thin wrapper over task management types like Handle, and provides implicit “tracing” for spawned futures by ensuring that the task is attached to the current tracing span and the current allocation component.

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<T> HandleExt<T> for Handle

Source§

fn spawn_traced<F>(&self, f: F) -> JoinHandle<T>
where F: Future<Output = T> + Send + 'static, T: Send + 'static,

Source§

fn spawn_traced_named<S, F>(&self, name: S, f: F) -> JoinHandle<T>
where S: Into<String>, F: Future<Output = T> + Send + 'static, T: Send + 'static,

Implementors§