pub trait FutureExt: Sized {
// Provided methods
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ { ... }
fn with_current_context(self) -> WithContext<Self> ⓘ { ... }
}
Available on crate feature
trace
only.Expand description
Extension trait allowing futures, streams, and sinks to be traced with a span.
Provided Methods§
Sourcefn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Attaches the provided Context
to this type, returning a WithContext
wrapper.
When the wrapped type is a future, stream, or sink, the attached context will be set as current while it is being polled.
Sourcefn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Attaches the current Context
to this type, returning a WithContext
wrapper.
When the wrapped type is a future, stream, or sink, the attached context will be set as the default while it is being polled.
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.