[][src]Struct holochain_tracing::SpanWrap

pub struct SpanWrap<T> {
    pub data: T,
    pub span_context: Option<HSpanContext>,
}

SpanWrap is a simple way to couple some data along with a struct. It is common to send some data on a channel which will be used as arguments to a function on the receiving side, where we also want to continue the trace on the receiving side. This struct helps keep that data together with minimal boilerplate.

The use of shrinkwrap allows the entire struct to be used as if it were a bare T (in most situations), but the RjSpan can also be extracted.

Fields

data: Tspan_context: Option<HSpanContext>

Methods

impl<T> SpanWrap<T>[src]

pub fn new(data: T, span_context: Option<HSpanContext>) -> Self[src]

pub fn follower<S: Into<Cow<'static, str>>>(
    &self,
    tracer: &Tracer,
    operation_name: S
) -> Option<HSpan>
[src]

pub fn follower_or_null<S: Into<Cow<'static, str>>>(
    &self,
    tracer: &Tracer,
    operation_name: S
) -> HSpan
[src]

pub fn follower_<'a, N: Into<Cow<'static, str>>, F>(
    &'a self,
    tracer: &Tracer,
    operation_name: N,
    f: F
) -> Option<HSpan> where
    F: FnOnce(StartSpanOptions<BoxSampler<SpanContextState>, SpanContextState>) -> RjSpan
[src]

pub fn map<F, U>(self, f: F) -> SpanWrap<U> where
    F: FnOnce(T) -> U, 
[src]

Map the data field to a new value while keeping the same span_context

Trait Implementations

impl<T> AsMut<T> for SpanWrap<T>[src]

impl<T> AsRef<T> for SpanWrap<T>[src]

impl<T> Borrow<T> for SpanWrap<T>[src]

impl<T> BorrowMut<T> for SpanWrap<T>[src]

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

impl<T> Deref for SpanWrap<T>[src]

type Target = T

The resulting type after dereferencing.

impl<T> DerefMut for SpanWrap<T>[src]

impl<'a, T> From<EncodedSpanWrap<T>> for SpanWrap<T> where
    T: Serialize + DeserializeOwned + Clone
[src]

impl<'a, T> From<SpanWrap<T>> for EncodedSpanWrap<T> where
    T: Serialize + DeserializeOwned + Clone
[src]

impl<T: PartialEq> PartialEq<SpanWrap<T>> for SpanWrap<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for SpanWrap<T> where
    T: RefUnwindSafe

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

impl<T> Sync for SpanWrap<T> where
    T: Sync

impl<T> Unpin for SpanWrap<T> where
    T: Unpin

impl<T> UnwindSafe for SpanWrap<T> where
    T: UnwindSafe

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>,