Struct Current
pub struct Current { /* private fields */ }
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
impl Current
fn new(id: Id, metadata: &'static Metadata<'static>) -> SelfConstructs a new
Currentthat indicates the current context is a span with the givenmetadataandmetadata.fn none() -> SelfConstructs a new
Currentthat indicates the current context is not in a span.fn is_known(&self) -> boolReturns
trueif theSubscriberthat constructed thisCurrenttracks a current span.If this returns
trueandid,metadata, orinto_innerreturnNone, that indicates that we are currently known to not be inside a span. If this returnsfalse, those methods will also returnNone, but in this case, that is because the subscriber does not keep track of the currently-entered span.fn into_inner(self) -> Option<(Id, &'static Metadata<'static>)>Consumes
selfand returns the spanIdandMetadataof the current span, if one exists and is known.fn id(&self) -> Option<&Id>Borrows the
Idof the current span, if one exists and is known.fn metadata(&self) -> Option<&'static Metadata<'static>>Borrows the
Metadataof the current span, if one exists and is known.
Trait Implementations
impl Debug for Current
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl !RefUnwindSafe for Current
impl !UnwindSafe for Current
impl Freeze for Current
impl Send for Current
impl Sync for Current
impl Unpin for Current
impl UnsafeUnpin for Current
Blanket Implementations
impl<T> Any for Current
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Current
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Current
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Current
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for Current
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Current
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Current
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>