Struct Attributes
pub struct Attributes<'a> { /* private fields */ }
Expand description
Attributes provided to a Subscriber
describing a new span when it is
created.
Implementations§
§impl<'a> Attributes<'a>
impl<'a> Attributes<'a>
pub fn new(
metadata: &'static Metadata<'static>,
values: &'a ValueSet<'a>,
) -> Attributes<'a>
Available on crate feature cpu_os_threads
only.
pub fn new( metadata: &'static Metadata<'static>, values: &'a ValueSet<'a>, ) -> Attributes<'a>
cpu_os_threads
only.Returns Attributes
describing a new child span of the current span,
with the provided metadata and values.
pub fn new_root(
metadata: &'static Metadata<'static>,
values: &'a ValueSet<'a>,
) -> Attributes<'a>
Available on crate feature cpu_os_threads
only.
pub fn new_root( metadata: &'static Metadata<'static>, values: &'a ValueSet<'a>, ) -> Attributes<'a>
cpu_os_threads
only.Returns Attributes
describing a new span at the root of its own trace
tree, with the provided metadata and values.
pub fn child_of(
parent: Id,
metadata: &'static Metadata<'static>,
values: &'a ValueSet<'a>,
) -> Attributes<'a>
Available on crate feature cpu_os_threads
only.
pub fn child_of( parent: Id, metadata: &'static Metadata<'static>, values: &'a ValueSet<'a>, ) -> Attributes<'a>
cpu_os_threads
only.Returns Attributes
describing a new child span of the specified
parent span, with the provided metadata and values.
pub fn metadata(&self) -> &'static Metadata<'static>
Available on crate feature cpu_os_threads
only.
pub fn metadata(&self) -> &'static Metadata<'static>
cpu_os_threads
only.Returns a reference to the new span’s metadata.
pub fn values(&self) -> &ValueSet<'a>
Available on crate feature cpu_os_threads
only.
pub fn values(&self) -> &ValueSet<'a>
cpu_os_threads
only.Returns a reference to a ValueSet
containing any values the new span
was created with.
pub fn is_root(&self) -> bool
Available on crate feature cpu_os_threads
only.
pub fn is_root(&self) -> bool
cpu_os_threads
only.Returns true if the new span should be a root.
pub fn is_contextual(&self) -> bool
Available on crate feature cpu_os_threads
only.
pub fn is_contextual(&self) -> bool
cpu_os_threads
only.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.
pub fn parent(&self) -> Option<&Id>
Available on crate feature cpu_os_threads
only.
pub fn parent(&self) -> Option<&Id>
cpu_os_threads
only.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
.
pub fn record(&self, visitor: &mut dyn Visit)
Available on crate feature cpu_os_threads
only.
pub fn record(&self, visitor: &mut dyn Visit)
cpu_os_threads
only.Records all the fields in this set of Attributes
with the provided
Visitor.
pub fn contains(&self, field: &Field) -> bool
Available on crate feature cpu_os_threads
only.
pub fn contains(&self, field: &Field) -> bool
cpu_os_threads
only.Returns true
if this set of Attributes
contains a value for the
given Field
.
pub fn is_empty(&self) -> bool
Available on crate feature cpu_os_threads
only.
pub fn is_empty(&self) -> bool
cpu_os_threads
only.Returns true if this set of Attributes
contains no values.
pub fn fields(&self) -> &FieldSet
Available on crate feature cpu_os_threads
only.
pub fn fields(&self) -> &FieldSet
cpu_os_threads
only.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§
Auto Trait Implementations§
impl<'a> Freeze for Attributes<'a>
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> 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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.