pub struct Current { /* private fields */ }
Expand description
Indicates what the Subscriber
considers the “current” span.
As subscribers may not track a notion of a current span, this has three possible states:
Implementations§
Source§impl Current
impl Current
Sourcepub fn new(id: Id, metadata: &'static Metadata<'static>) -> Self
pub fn new(id: Id, metadata: &'static Metadata<'static>) -> Self
Constructs a new Current
that indicates the current context is a span
with the given metadata
and metadata
.
Sourcepub fn none() -> Self
pub fn none() -> Self
Constructs a new Current
that indicates the current context is not
in a span.
Sourcepub fn is_known(&self) -> bool
pub fn is_known(&self) -> bool
Returns true
if the Subscriber
that constructed this Current
tracks a
current span.
If this returns true
and id
, metadata
, or into_inner
return None
, that indicates that we are currently known to not be
inside a span. If this returns false
, those methods will also return
None
, but in this case, that is because the subscriber does not keep
track of the currently-entered span.
Sourcepub fn into_inner(self) -> Option<(Id, &'static Metadata<'static>)>
pub fn into_inner(self) -> Option<(Id, &'static Metadata<'static>)>
Consumes self
and returns the span Id
and Metadata
of the current
span, if one exists and is known.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Current
impl !RefUnwindSafe for Current
impl Send for Current
impl Sync for Current
impl Unpin for Current
impl !UnwindSafe for Current
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
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes