pub struct CapturedSpan {
pub id: u64,
pub name: &'static str,
pub target: &'static str,
pub parent: Option<u64>,
pub parent_name: Option<&'static str>,
pub declared: Vec<&'static str>,
pub initial: Map<String, Value>,
pub recorded: Vec<(String, Value)>,
pub follows_from: Vec<u64>,
}test-utils only.Expand description
One span as TraceCapture saw it.
Fields§
§id: u64The span’s id, unique while the span is open.
name: &'static strThe span’s name.
target: &'static strThe span’s target.
parent: Option<u64>The explicit parent, or the current span for a contextual span.
parent_name: Option<&'static str>The parent’s name.
declared: Vec<&'static str>Every field the span declares, in declaration order.
initial: Map<String, Value>The values given when the span was created.
recorded: Vec<(String, Value)>Every value recorded later, in order, repeats included.
follows_from: Vec<u64>The ids this span follows from.
Implementations§
Source§impl CapturedSpan
impl CapturedSpan
Sourcepub fn value(&self, field: &str) -> Option<&Value>
pub fn value(&self, field: &str) -> Option<&Value>
The latest value of field: its last recording, else its initial value.
Sourcepub fn text(&self, field: &str) -> Option<String>
pub fn text(&self, field: &str) -> Option<String>
Self::value as text: a string as it is, anything else as JSON.
Sourcepub fn u64(&self, field: &str) -> Option<u64>
pub fn u64(&self, field: &str) -> Option<u64>
The latest value of field when it is an unsigned integer.
Sourcepub fn recorded_texts(&self, field: &str) -> Vec<String>
pub fn recorded_texts(&self, field: &str) -> Vec<String>
Every value of field recorded after creation, in order, as text.
Sourcepub fn record_count(&self, field: &str) -> usize
pub fn record_count(&self, field: &str) -> usize
How many times field was recorded after creation.
Sourcepub fn values(&self) -> Map<String, Value>
pub fn values(&self) -> Map<String, Value>
The initial values with every later recording applied in order.
Sourcepub fn summary(&self) -> Value
pub fn summary(&self) -> Value
The span without its id, which differs between runs: name, target,
parent name, declared fields and Self::values.
Trait Implementations§
Source§impl Clone for CapturedSpan
impl Clone for CapturedSpan
Auto Trait Implementations§
impl Freeze for CapturedSpan
impl RefUnwindSafe for CapturedSpan
impl Send for CapturedSpan
impl Sync for CapturedSpan
impl Unpin for CapturedSpan
impl UnsafeUnpin for CapturedSpan
impl UnwindSafe for CapturedSpan
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more