Struct opentelemetry::trace::TraceId
source · pub struct TraceId(/* private fields */);
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
)