pub struct WithSpanExecutor<E> { /* private fields */ }Available on crate feature
tracing only.Expand description
An executor that propagates a provided tracing span to its futures.
The span provided to this executor is entered each time the future is polled or dropped. Execution is delegated to the wrapped executor, without requiring a particular runtime.
Requires the tracing feature.
§Example
use hyper_util::rt::{TokioExecutor, WithSpanExecutor};
let span = tracing::info_span!("example");
let executor = WithSpanExecutor::new(TokioExecutor::new(), span);Implementations§
Source§impl<E> WithSpanExecutor<E>
impl<E> WithSpanExecutor<E>
Sourcepub fn new(inner: E, span: Span) -> Self
pub fn new(inner: E, span: Span) -> Self
Wrap an executor to propagate the provided tracing span to its futures.
Sourcepub fn current(inner: E) -> Self
pub fn current(inner: E) -> Self
Wrap an executor to propagate the current tracing span to its futures.
This will instrument futures with the span that is active at the call-site of this
function. Use CurrentSpanExecutor<E> if you would prefer to propagate the current span
when Executor::execute() is called, rather than span that is active when initializating
the executor.
Trait Implementations§
Source§impl<E: Clone> Clone for WithSpanExecutor<E>
impl<E: Clone> Clone for WithSpanExecutor<E>
Source§impl<E: Debug> Debug for WithSpanExecutor<E>
impl<E: Debug> Debug for WithSpanExecutor<E>
Source§impl<E, F> Executor<F> for WithSpanExecutor<E>
impl<E, F> Executor<F> for WithSpanExecutor<E>
Auto Trait Implementations§
impl<E> !RefUnwindSafe for WithSpanExecutor<E>
impl<E> !UnwindSafe for WithSpanExecutor<E>
impl<E> Freeze for WithSpanExecutor<E>where
E: Freeze,
impl<E> Send for WithSpanExecutor<E>where
E: Send,
impl<E> Sync for WithSpanExecutor<E>where
E: Sync,
impl<E> Unpin for WithSpanExecutor<E>where
E: Unpin,
impl<E> UnsafeUnpin for WithSpanExecutor<E>where
E: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more