Struct Id

pub struct Id(/* private field */);

Identifies a span within the context of a subscriber.

They are generated by Subscribers for each span as it is created, by the new_span trait method. See the documentation for that method for more information on span ID generation.

Implementations

impl Id

fn from_u64(u: u64) -> Self

Constructs a new span ID from the given u64.

    Note: Span IDs must be greater than zero.

Panics

  • If the provided u64 is 0.
const fn from_non_zero_u64(id: NonZeroU64) -> Self

Constructs a new span ID from the given NonZeroU64.

Unlike Id::from_u64, this will never panic.

fn into_u64(&self) -> u64

Returns the span's ID as a u64.

const fn into_non_zero_u64(&self) -> NonZeroU64

Returns the span's ID as a NonZeroU64.

Trait Implementations

impl Clone for Id

fn clone(&self) -> Self

impl Debug for Id

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Eq for Id

impl Hash for Id

fn hash<__H: Hasher>(&self, state: &mut __H)

impl PartialEq for Id

fn eq(&self, other: &Self) -> bool

impl StructuralPartialEq for Id

Auto Trait Implementations

impl Freeze for Id

impl RefUnwindSafe for Id

impl Send for Id

impl Sync for Id

impl Unpin for Id

impl UnsafeUnpin for Id

impl UnwindSafe for Id

Blanket Implementations

impl<T> Any for Id where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Id where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Id where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for Id where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for Id

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Id where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for Id 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 Id where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Id where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>