[][src]Struct rustracing::span::Span

pub struct Span<T>(_);

Span.

When this span is dropped, it will be converted to FinishedSpan and it will be sent to the associated SpanReceiver.

Methods

impl<T> Span<T>[src]

pub fn inactive() -> Self[src]

Makes an inactive span.

This span is never traced.

Examples

use rustracing::span::Span;

let span = Span::<()>::inactive();
assert!(! span.is_sampled());

pub fn handle(&self) -> SpanHandle<T> where
    T: Clone
[src]

Returns a handle of this span.

pub fn is_sampled(&self) -> bool[src]

Returns true if this span is sampled (i.e., being traced).

pub fn context(&self) -> Option<&SpanContext<T>>[src]

Returns the context of this span.

pub fn set_operation_name<F, N>(&mut self, f: F) where
    F: FnOnce() -> N,
    N: Into<Cow<'static, str>>, 
[src]

Sets the operation name of this span.

pub fn set_finish_time<F>(&mut self, f: F) where
    F: FnOnce() -> SystemTime
[src]

Sets the finish time of this span.

pub fn set_tag<F>(&mut self, f: F) where
    F: FnOnce() -> Tag
[src]

Sets the tag to this span.

pub fn set_tags<F, I>(&mut self, f: F) where
    F: FnOnce() -> I,
    I: IntoIterator<Item = Tag>, 
[src]

Sets the tags to this span.

pub fn set_baggage_item<F>(&mut self, f: F) where
    F: FnOnce() -> BaggageItem
[src]

Sets the baggage item to this span.

pub fn get_baggage_item(&self, name: &str) -> Option<&BaggageItem>[src]

Gets the baggage item that has the name name.

pub fn log<F>(&mut self, f: F) where
    F: FnOnce(&mut LogBuilder), 
[src]

Logs structured data.

pub fn error_log<F>(&mut self, f: F) where
    F: FnOnce(&mut StdErrorLogFieldsBuilder), 
[src]

Logs an error.

This is a simple wrapper of log method except that the StdTag::error() tag will be set in this method.

pub fn child<N, F>(&self, operation_name: N, f: F) -> Span<T> where
    N: Into<Cow<'static, str>>,
    T: Clone,
    F: FnOnce(StartSpanOptions<AllSampler, T>) -> Span<T>, 
[src]

Starts a ChildOf span if this span is sampled.

pub fn follower<N, F>(&self, operation_name: N, f: F) -> Span<T> where
    N: Into<Cow<'static, str>>,
    T: Clone,
    F: FnOnce(StartSpanOptions<AllSampler, T>) -> Span<T>, 
[src]

Starts a FollowsFrom span if this span is sampled.

Trait Implementations

impl<T> MaybeAsRef<SpanContext<T>> for Span<T>[src]

impl<T> Drop for Span<T>[src]

impl<T: Debug> Debug for Span<T>[src]

Auto Trait Implementations

impl<T> Send for Span<T> where
    T: Send

impl<T> Sync for Span<T> where
    T: Send + Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]