[][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 map<__SHRINKWRAP_T, __SHRINKWRAP_F: FnMut(T) -> __SHRINKWRAP_T>(
    self,
    f: __SHRINKWRAP_F
) -> __SHRINKWRAP_T
[src]

Map a function over the wrapped value, consuming it in the process.

pub fn map_ref<__SHRINKWRAP_T, __SHRINKWRAP_F: FnMut(&T) -> __SHRINKWRAP_T>(
    &self,
    f: __SHRINKWRAP_F
) -> __SHRINKWRAP_T
[src]

Map a function over the wrapped value without consuming it.

pub fn map_mut<__SHRINKWRAP_T, __SHRINKWRAP_F>(
    &mut self,
    f: __SHRINKWRAP_F
) -> __SHRINKWRAP_T where
    __SHRINKWRAP_F: FnMut(&mut T) -> __SHRINKWRAP_T, 
[src]

Map a function over the wrapped value, potentially changing it in place.

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_<'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]

Trait Implementations

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

impl<T> AsRef<T> 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<T: Debug> Debug for SpanWrap<T>[src]

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

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

Auto Trait Implementations

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

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

Blanket Implementations

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 = !

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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