pub struct SpanCtx<'a> {
pub labels: &'a [(&'static str, &'a str)],
pub spans: &'a [SpanFrame<'a>],
}Expand description
Read-only view of the active scope/span context that
register_typed-style closures receive. Spec 12 § 3.6.
Carries the labels the user has named in obs::scope! plus the span
ancestry (oldest first) for tracing source spans. Keeps two slices
borrowed from caller-owned storage so the bridge never allocates.
Fields§
§labels: &'a [(&'static str, &'a str)]Labels from the active obs::scope! allowlist, outermost first.
spans: &'a [SpanFrame<'a>]Tracing span ancestry, oldest first; empty if this SpanCtx
originates from a non-bridge path.
Implementations§
Source§impl<'a> SpanCtx<'a>
impl<'a> SpanCtx<'a>
Sourcepub const fn empty() -> Self
pub const fn empty() -> Self
Empty context. Useful for non-bridge call sites that still want
to pass a SpanCtx to a typed promotion closure.
Sourcepub fn label(&self, name: &str) -> Option<&'a str>
pub fn label(&self, name: &str) -> Option<&'a str>
Look up a label by name. Returns the innermost (last) match so nested scopes shadow outer ones.
Trait Implementations§
impl<'a> Copy for SpanCtx<'a>
Auto Trait Implementations§
impl<'a> Freeze for SpanCtx<'a>
impl<'a> RefUnwindSafe for SpanCtx<'a>
impl<'a> Send for SpanCtx<'a>
impl<'a> Sync for SpanCtx<'a>
impl<'a> Unpin for SpanCtx<'a>
impl<'a> UnsafeUnpin for SpanCtx<'a>
impl<'a> UnwindSafe for SpanCtx<'a>
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