InspectExt

Trait InspectExt 

Source
pub trait InspectExt: Future + Sized {
    // Provided methods
    fn inspect(self, name: impl Into<String>) -> TrackedFuture<Self>  { ... }
    fn spawn_tracked(self, name: impl Into<String>) -> JoinHandle<Self::Output>
       where Self: Send + 'static,
             Self::Output: Send + 'static { ... }
}
Expand description

Extension trait for async-std futures to add tracking

§Examples

use async_inspect::runtime::async_std::InspectExt;

async_std::task::block_on(async {
    let result = async {
        // Your async code
        42
    }
    .inspect("my_operation")
    .await;
});

Provided Methods§

Source

fn inspect(self, name: impl Into<String>) -> TrackedFuture<Self>

Wrap this future with automatic tracking

Source

fn spawn_tracked(self, name: impl Into<String>) -> JoinHandle<Self::Output>
where Self: Send + 'static, Self::Output: Send + 'static,

Spawn this future on async-std with tracking

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.

Implementors§

Source§

impl<F: Future> InspectExt for F