pub struct SpanContext<T> { /* private fields */ }Expand description
Span context.
Each SpanContext encapsulates the following state:
T: OpenTracing-implementation-dependent state (for example, trace and span ids) needed to refer to a distinctSpanacross a process boundaryBaggageItems: These are just key:value pairs that cross process boundaries
Implementations§
Source§impl<T> SpanContext<T>
impl<T> SpanContext<T>
Sourcepub fn new(state: T, baggage_items: Vec<BaggageItem>) -> Self
pub fn new(state: T, baggage_items: Vec<BaggageItem>) -> Self
Makes a new SpanContext instance.
Sourcepub fn baggage_items(&self) -> &[BaggageItem]
pub fn baggage_items(&self) -> &[BaggageItem]
Returns the baggage items associated with this context.
Sourcepub fn inject_to_text_map<C>(&self, carrier: &mut C) -> Result<()>where
C: TextMap,
T: InjectToTextMap<C>,
pub fn inject_to_text_map<C>(&self, carrier: &mut C) -> Result<()>where
C: TextMap,
T: InjectToTextMap<C>,
Injects this context to the Text Map carrier.
Sourcepub fn inject_to_http_header<C>(&self, carrier: &mut C) -> Result<()>where
C: SetHttpHeaderField,
T: InjectToHttpHeader<C>,
pub fn inject_to_http_header<C>(&self, carrier: &mut C) -> Result<()>where
C: SetHttpHeaderField,
T: InjectToHttpHeader<C>,
Injects this context to the HTTP Header carrier.
Sourcepub fn inject_to_binary<C>(&self, carrier: &mut C) -> Result<()>where
C: Write,
T: InjectToBinary<C>,
pub fn inject_to_binary<C>(&self, carrier: &mut C) -> Result<()>where
C: Write,
T: InjectToBinary<C>,
Injects this context to the Binary carrier.
Sourcepub fn extract_from_text_map<C>(carrier: &C) -> Result<Option<Self>>where
C: TextMap,
T: ExtractFromTextMap<C>,
pub fn extract_from_text_map<C>(carrier: &C) -> Result<Option<Self>>where
C: TextMap,
T: ExtractFromTextMap<C>,
Extracts a context from the Text Map carrier.
Sourcepub fn extract_from_http_header<'a, C>(carrier: &'a C) -> Result<Option<Self>>where
C: IterHttpHeaderFields<'a>,
T: ExtractFromHttpHeader<'a, C>,
pub fn extract_from_http_header<'a, C>(carrier: &'a C) -> Result<Option<Self>>where
C: IterHttpHeaderFields<'a>,
T: ExtractFromHttpHeader<'a, C>,
Extracts a context from the HTTP Header carrier.
Sourcepub fn extract_from_binary<C>(carrier: &mut C) -> Result<Option<Self>>where
C: Read,
T: ExtractFromBinary<C>,
pub fn extract_from_binary<C>(carrier: &mut C) -> Result<Option<Self>>where
C: Read,
T: ExtractFromBinary<C>,
Extracts a context from the Binary carrier.
Trait Implementations§
Source§impl<T: Clone> Clone for SpanContext<T>
impl<T: Clone> Clone for SpanContext<T>
Source§fn clone(&self) -> SpanContext<T>
fn clone(&self) -> SpanContext<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for SpanContext<T>
impl<T: Debug> Debug for SpanContext<T>
Source§impl<T> MaybeAsRef<SpanContext<T>> for Span<T>
impl<T> MaybeAsRef<SpanContext<T>> for Span<T>
Source§fn maybe_as_ref(&self) -> Option<&SpanContext<T>>
fn maybe_as_ref(&self) -> Option<&SpanContext<T>>
Performs the conversion.
Source§impl<T> MaybeAsRef<SpanContext<T>> for SpanContext<T>
impl<T> MaybeAsRef<SpanContext<T>> for SpanContext<T>
Source§fn maybe_as_ref(&self) -> Option<&Self>
fn maybe_as_ref(&self) -> Option<&Self>
Performs the conversion.
Auto Trait Implementations§
impl<T> Freeze for SpanContext<T>where
T: Freeze,
impl<T> RefUnwindSafe for SpanContext<T>where
T: RefUnwindSafe,
impl<T> Send for SpanContext<T>where
T: Send,
impl<T> Sync for SpanContext<T>where
T: Sync,
impl<T> Unpin for SpanContext<T>where
T: Unpin,
impl<T> UnwindSafe for SpanContext<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more