Trait embedded_trace::TraceFuture
source · pub trait TraceFuture: Futurewhere
Self: Sized,{
// Provided methods
fn trace_task<I: Instrument>(
self,
instrument: &mut I
) -> TraceTaskFuture<'_, Self, I> { ... }
fn trace_poll<I: Instrument>(
self,
instrument: &mut I
) -> TracePollFuture<'_, Self, I> { ... }
fn trace_task_and_poll<'a, I1: Instrument, I2: Instrument>(
self,
task_instrument: &'a mut I1,
poll_instrument: &'a mut I2
) -> TraceTaskAndPollFuture<'a, Self, I1, I2> { ... }
}
Expand description
Extension to Future
with tracing utilities.
Each method takes one or more Instrument
parameters which dictate the mechanism used to signal when a span is entered
and exited. Refer to each method’s documentation for more information.
Provided Methods§
sourcefn trace_task<I: Instrument>(
self,
instrument: &mut I
) -> TraceTaskFuture<'_, Self, I>
fn trace_task<I: Instrument>( self, instrument: &mut I ) -> TraceTaskFuture<'_, Self, I>
Trace a Future
’s task execution.
The underlying Instrument
calls on_enter
when the future is first
polled, and calls on_exit
when it completes
(returns Poll::Ready
). This is useful for analyzing the total time
it takes for your future to complete (note that this is different from
the real CPU time the task consumes).
sourcefn trace_poll<I: Instrument>(
self,
instrument: &mut I
) -> TracePollFuture<'_, Self, I>
fn trace_poll<I: Instrument>( self, instrument: &mut I ) -> TracePollFuture<'_, Self, I>
Trace a Future
poll execution.
The underlying Instrument
calls on_enter
every time prior to the
underlying future being polled, and calls and calls
on_exit
when it completes (returns
on_exit
right after the poll
call completes, regardless of whether the underlying future completed or
not. This is useful for analyzing the time it takes to poll your future
(ie, actual CPU time used).
sourcefn trace_task_and_poll<'a, I1: Instrument, I2: Instrument>(
self,
task_instrument: &'a mut I1,
poll_instrument: &'a mut I2
) -> TraceTaskAndPollFuture<'a, Self, I1, I2>
fn trace_task_and_poll<'a, I1: Instrument, I2: Instrument>( self, task_instrument: &'a mut I1, poll_instrument: &'a mut I2 ) -> TraceTaskAndPollFuture<'a, Self, I1, I2>
Trace a Future
’s task and poll execution.
The first underlying Instrument
(task_instrument
) acts exactly as
trace_task
, and the second underlying
Instrument
(poll_instrument
) acts exactly as
trace_poll
.