pub struct TraceId(/* private fields */);
Available on crate feature
trace
only.Expand description
A 16-byte value which identifies a given trace.
The id is valid if it contains at least one non-zero byte.
Implementations§
Source§impl TraceId
impl TraceId
Sourcepub const fn from_bytes(bytes: [u8; 16]) -> Self
pub const fn from_bytes(bytes: [u8; 16]) -> Self
Create a trace id from its representation as a byte array.
Sourcepub const fn to_bytes(self) -> [u8; 16]
pub const fn to_bytes(self) -> [u8; 16]
Return the representation of this trace id as a byte array.
Sourcepub fn from_hex(hex: &str) -> Result<Self, ParseIntError>
pub fn from_hex(hex: &str) -> Result<Self, ParseIntError>
Converts a string in base 16 to a trace id.
§Examples
use opentelemetry::trace::TraceId;
assert!(TraceId::from_hex("42").is_ok());
assert!(TraceId::from_hex("58406520a006649127e371903a2de979").is_ok());
assert!(TraceId::from_hex("not_hex").is_err());
Trait Implementations§
impl Copy for TraceId
impl Eq for TraceId
impl StructuralPartialEq for TraceId
Auto Trait Implementations§
impl Freeze for TraceId
impl RefUnwindSafe for TraceId
impl Send for TraceId
impl Sync for TraceId
impl Unpin for TraceId
impl UnwindSafe for TraceId
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Available on crate feature
trace
only.Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Available on crate feature
trace
only.