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>) -> Self

Constructs a new Current that indicates the current context is a span with the given metadata and metadata.

fn none() -> Self

Constructs a new Current that indicates the current context is not in a span.

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.

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.

fn id(&self) -> Option<&Id>

Borrows the Id of the current span, if one exists and is known.

fn metadata(&self) -> Option<&'static Metadata<'static>>

Borrows the Metadata of 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) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for Current where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses 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>