pub struct Context { /* private fields */ }
Expand description
A metric context.
Implementations§
Source§impl Context
impl Context
Sourcepub fn from_static_name(name: &'static str) -> Self
pub fn from_static_name(name: &'static str) -> Self
Creates a new Context
from the given static name.
Sourcepub fn from_static_parts(name: &'static str, tags: &[&'static str]) -> Self
pub fn from_static_parts(name: &'static str, tags: &[&'static str]) -> Self
Creates a new Context
from the given static name and given static tags.
Sourcepub fn from_parts<S: Into<MetaString>>(name: S, tags: SharedTagSet) -> Self
pub fn from_parts<S: Into<MetaString>>(name: S, tags: SharedTagSet) -> Self
Creates a new Context
from the given name and given tags.
Sourcepub fn with_name<S: Into<MetaString>>(&self, name: S) -> Self
pub fn with_name<S: Into<MetaString>>(&self, name: S) -> Self
Clones this context, and uses the given name for the cloned context.
Returns the instrumented tags of this context.
Returns the origin tags of this context.
Sourcepub fn size_of(&self) -> usize
pub fn size_of(&self) -> usize
Returns the size of this context in bytes.
A context’s size is the sum of the sizes of its fields and the size of the Context
struct itself, and
includes:
- the context name
- the context tags (both instrumented and origin)
Since origin tags can potentially be expensive to calculate, this method will cache the size of the origin tags when this method is first called.
Additionally, the value returned by this method does not compensate for externalities such as origin tags potentially being shared by multiple contexts, or whether or not tags are are inlined, interned, or heap allocated. This means that the value returned is essentially the worst-case usage, and should be used as a rough estimate.
Trait Implementations§
impl Eq for Context
impl StructuralPartialEq for Context
Auto Trait Implementations§
impl Freeze for Context
impl !RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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>
§impl<T> Track for T
impl<T> Track for T
§fn track_allocations(self, token: AllocationGroupToken) -> Tracked<Self>
fn track_allocations(self, token: AllocationGroupToken) -> Tracked<Self>
Tracked
wrapper. Read more§fn in_current_allocation_group(self) -> Tracked<Self>
fn in_current_allocation_group(self) -> Tracked<Self>
Tracked
wrapper. Read more