Struct sp_tracing::span::Attributes
source · pub struct Attributes<'a> { /* private fields */ }
Expand description
Attributes provided to a Subscriber
describing a new span when it is
created.
Implementations§
source§impl<'a> Attributes<'a>
impl<'a> Attributes<'a>
sourcepub fn new(
metadata: &'static Metadata<'static>,
values: &'a ValueSet<'a>
) -> Attributes<'a>
pub fn new(
metadata: &'static Metadata<'static>,
values: &'a ValueSet<'a>
) -> Attributes<'a>
Returns Attributes
describing a new child span of the current span,
with the provided metadata and values.
sourcepub fn new_root(
metadata: &'static Metadata<'static>,
values: &'a ValueSet<'a>
) -> Attributes<'a>
pub fn new_root(
metadata: &'static Metadata<'static>,
values: &'a ValueSet<'a>
) -> Attributes<'a>
Returns Attributes
describing a new span at the root of its own trace
tree, with the provided metadata and values.
sourcepub fn child_of(
parent: Id,
metadata: &'static Metadata<'static>,
values: &'a ValueSet<'a>
) -> Attributes<'a>
pub fn child_of(
parent: Id,
metadata: &'static Metadata<'static>,
values: &'a ValueSet<'a>
) -> Attributes<'a>
Returns Attributes
describing a new child span of the specified
parent span, with the provided metadata and values.
sourcepub fn metadata(&self) -> &'static Metadata<'static>
pub fn metadata(&self) -> &'static Metadata<'static>
Returns a reference to the new span’s metadata.
sourcepub fn values(&self) -> &ValueSet<'a>
pub fn values(&self) -> &ValueSet<'a>
Returns a reference to a ValueSet
containing any values the new span
was created with.
sourcepub fn is_contextual(&self) -> bool
pub fn is_contextual(&self) -> bool
Returns true if the new span’s parent should be determined based on the current context.
If this is true and the current thread is currently inside a span, then that span should be the new span’s parent. Otherwise, if the current thread is not inside a span, then the new span will be the root of its own trace tree.
sourcepub fn parent(&self) -> Option<&Id>
pub fn parent(&self) -> Option<&Id>
Returns the new span’s explicitly-specified parent, if there is one.
Otherwise (if the new span is a root or is a child of the current span),
returns None
.
sourcepub fn record(&self, visitor: &mut dyn Visit)
pub fn record(&self, visitor: &mut dyn Visit)
Records all the fields in this set of Attributes
with the provided
Visitor.
sourcepub fn contains(&self, field: &Field) -> bool
pub fn contains(&self, field: &Field) -> bool
Returns true
if this set of Attributes
contains a value for the
given Field
.
sourcepub fn fields(&self) -> &FieldSet
pub fn fields(&self) -> &FieldSet
Returns the set of all fields defined by this span’s Metadata
.
Note that the FieldSet
returned by this method includes all the
fields declared by this span, not just those with values that are recorded
as part of this set of Attributes
. Other fields with values not present in
this Attributes
’ value set may record values later.
Trait Implementations§
source§impl<'a> AsMap for Attributes<'a>
impl<'a> AsMap for Attributes<'a>
fn field_map(&self) -> SerializeFieldMap<'_, Self>
source§impl<'a> AsSerde<'a> for Attributes<'a>
impl<'a> AsSerde<'a> for Attributes<'a>
type Serializable = SerializeAttributes<'a>
source§fn as_serde(&'a self) -> <Attributes<'a> as AsSerde<'a>>::Serializable
fn as_serde(&'a self) -> <Attributes<'a> as AsSerde<'a>>::Serializable
as_serde
borrows a tracing
value and returns the serialized value.source§impl<'a> Debug for Attributes<'a>
impl<'a> Debug for Attributes<'a>
source§impl From<&Attributes<'_>> for WasmEntryAttributes
impl From<&Attributes<'_>> for WasmEntryAttributes
source§fn from(attrs: &Attributes<'_>) -> WasmEntryAttributes
fn from(attrs: &Attributes<'_>) -> WasmEntryAttributes
source§impl<'a> RecordFields for Attributes<'a>
impl<'a> RecordFields for Attributes<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Attributes<'a>
impl<'a> !Send for Attributes<'a>
impl<'a> !Sync for Attributes<'a>
impl<'a> Unpin for Attributes<'a>
impl<'a> !UnwindSafe for Attributes<'a>
Blanket Implementations§
source§impl<T> FmtForward for T
impl<T> FmtForward for T
source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
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> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds. Read moresource§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
.tap_borrow()
only in debug builds, and is erased in release
builds. Read moresource§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
.tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read moresource§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
.tap_ref()
only in debug builds, and is erased in release
builds. Read moresource§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
.tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more