Struct WithSpanExecutor

pub struct WithSpanExecutor<E> { /* private fields */ }

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

# #[cfg(feature = "tokio")]
# {
use hyper_util::rt::{TokioExecutor, WithSpanExecutor};

let span = tracing::info_span!("example");
let executor = WithSpanExecutor::new(TokioExecutor::new(), span);
# }

Implementations

impl<E> WithSpanExecutor<E>

fn new(inner: E, span: Span) -> Self

Wrap an executor to propagate the provided tracing span to its futures.

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

impl<E, F> Executor<F> for WithSpanExecutor<E> where E: Executor<Instrumented<F>>, F: Future,

fn execute(&self, future: F)

impl<E: Clone> Clone for WithSpanExecutor<E>

fn clone(&self) -> Self

impl<E: Debug> Debug for WithSpanExecutor<E>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

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

impl<A, B, T> HttpServerConnExec<A, B> for WithSpanExecutor<E> where B: Body, T: Http2ServerConnExec<A, B>,

impl<E, B, T> Http2ClientConnExec<B, T> for WithSpanExecutor<E> where E: Clone + Executor<H2ClientFuture<B, T, E>> + Http2UpgradedExec<<B as Body>::Data>, B: Body + 'static, <B as Body>::Error: Into<Box<dyn Error + Sync + Send>>, H2ClientFuture<B, T, E>: Future<Output = ()>, T: Read + Write + Unpin,

fn execute_h2_future(&mut self, future: H2ClientFuture<B, T, E>)

impl<E, F, B> Http2ServerConnExec<F, B> for WithSpanExecutor<E> where E: Clone + Executor<H2Stream<F, B, E>> + Http2UpgradedExec<<B as Body>::Data>, H2Stream<F, B, E>: Future<Output = ()>, B: Body,

fn execute_h2stream(&mut self, fut: H2Stream<F, B, E>)

impl<T> Any for WithSpanExecutor<E> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for WithSpanExecutor<E> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for WithSpanExecutor<E> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for WithSpanExecutor<E> where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for WithSpanExecutor<E>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for WithSpanExecutor<E>

impl<T> ToOwned for WithSpanExecutor<E> where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T> WithSubscriber for WithSpanExecutor<E>

impl<T, U> Into<U> for WithSpanExecutor<E> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for WithSpanExecutor<E> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for WithSpanExecutor<E> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>