[][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.

Implementations

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_start_time<F>(&mut self, f: F) where
    F: FnOnce() -> SystemTime
[src]

Sets the start time 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: Debug> Debug for Span<T>[src]

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

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

Auto Trait Implementations

impl<T> RefUnwindSafe for Span<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for Span<T> where
    T: Send
[src]

impl<T> Sync for Span<T> where
    T: Send + Sync
[src]

impl<T> Unpin for Span<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for Span<T> where
    T: UnwindSafe
[src]

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> 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<V, T> VZip<V> for T where
    V: MultiLane<T>,