tracing_futures

Trait WithSubscriber

Source
pub trait WithSubscriber: Sized {
    // Provided methods
    fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> 
       where S: Into<Dispatch> { ... }
    fn with_current_subscriber(self) -> WithDispatch<Self>  { ... }
}
Available on crate feature std only.
Expand description

Extension trait allowing futures, streams, and sinks to be instrumented with a tracing Subscriber.

Provided Methods§

Source

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper.

When the wrapped type is a future, stream, or sink, the attached subscriber will be set as the default while it is being polled. When the wrapped type is an executor, the subscriber will be set as the default for any futures spawned on that executor.

Source

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper.

When the wrapped type is a future, stream, or sink, the attached subscriber will be set as the default while it is being polled. When the wrapped type is an executor, the subscriber will be set as the default for any futures spawned on that executor.

This can be used to propagate the current dispatcher context when spawning a new future.

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§