Struct CurrentSpanExecutor

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

An executor that propagates the current tracing span to its futures.

The span is captured when execute is called, and 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, CurrentSpanExecutor};

let executor = CurrentSpanExecutor::new(TokioExecutor::new());
# }

Implementations

impl<E> CurrentSpanExecutor<E>

fn new(inner: E) -> Self

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

Trait Implementations

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

fn execute(&self, future: F)

impl<E: Clone> Clone for CurrentSpanExecutor<E>

fn clone(&self) -> Self

impl<E: Copy> Copy for CurrentSpanExecutor<E>

impl<E: Debug> Debug for CurrentSpanExecutor<E>

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

impl<E: Default> Default for CurrentSpanExecutor<E>

fn default() -> Self

Auto Trait Implementations

impl<E> Freeze for CurrentSpanExecutor<E> where E: Freeze,

impl<E> RefUnwindSafe for CurrentSpanExecutor<E> where E: RefUnwindSafe,

impl<E> Send for CurrentSpanExecutor<E> where E: Send,

impl<E> Sync for CurrentSpanExecutor<E> where E: Sync,

impl<E> Unpin for CurrentSpanExecutor<E> where E: Unpin,

impl<E> UnsafeUnpin for CurrentSpanExecutor<E> where E: UnsafeUnpin,

impl<E> UnwindSafe for CurrentSpanExecutor<E> where E: UnwindSafe,

Blanket Implementations

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

impl<E, B, T> Http2ClientConnExec<B, T> for CurrentSpanExecutor<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 CurrentSpanExecutor<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 CurrentSpanExecutor<E> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

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

impl<T> From<T> for CurrentSpanExecutor<E>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for CurrentSpanExecutor<E>

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

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

impl<T> WithSubscriber for CurrentSpanExecutor<E>

impl<T, U> Into<U> for CurrentSpanExecutor<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 CurrentSpanExecutor<E> where U: Into<T>,

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

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

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