Skip to main content

Span

Struct Span 

Source
pub struct Span {
    pub kind: &'static str,
    pub ordinal: usize,
    pub start: Stamp,
    pub stages: Vec<Stage>,
    /* private fields */
}
Expand description

Caller-labeled sequence of explicit evaluation boundaries.

A span is submitted to thread-local storage only by Span::finish. Dropping it without finishing discards its report; finishing adds no implicit boundary.

Fields§

§kind: &'static str

Caller-provided category, such as setup, a round, or settlement.

§ordinal: usize

Caller-provided index; this type imposes no numbering convention.

§start: Stamp

Clock and allocation readings captured when the span was constructed.

§stages: Vec<Stage>

Intervals recorded in mark order; a span may contain no marks.

Implementations§

Source§

impl Span

Source

pub fn new(kind: &'static str, ordinal: usize) -> Self

Capture the starting boundary and create an empty, unsubmitted span.

Clock-query failure panics. The category and ordinal are retained as metadata only; no engine, scope or evaluated value is retained.

Source

pub fn enter(&mut self, stage: EventStage)

Publish entry before the named operation. Marks instead label completed intervals and must never be interpreted as an operation’s start. An installed sink adds bounded diagnostic I/O; without one this is inert.

Source

pub fn mark(&mut self, name: &'static str)

Capture a boundary and append the interval since the preceding boundary.

Appending may grow the stage vector after the captured endpoint; that recording work falls inside a later interval if another mark follows. Clock-query failure panics before appending a stage.

Source

pub fn finish(self)

Submit this span to the current thread’s report buffer in finish order.

This may grow the buffer but takes no final sample. Work after the last mark, including submission, has no additional interval in this span.

Trait Implementations§

Source§

impl Serialize for Span

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl !Freeze for Span

§

impl !RefUnwindSafe for Span

§

impl !Send for Span

§

impl !Sync for Span

§

impl Forget for Span

§

impl Move for Span

§

impl Unpin for Span

§

impl UnsafeUnpin for Span

§

impl UnwindSafe for Span

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.