Struct opentelemetry::trace::TraceId
source · [−]pub struct TraceId(_);
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
sourceimpl TraceId
impl TraceId
sourcepub const fn from_bytes(bytes: [u8; 16]) -> TraceId
pub const fn from_bytes(bytes: [u8; 16]) -> TraceId
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<TraceId, ParseIntError>
pub fn from_hex(hex: &str) -> Result<TraceId, ParseIntError>
Converts a string in base 16 to a trace id.
Examples
use opentelemetry_api::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
sourceimpl PartialEq<TraceId> for TraceId
impl PartialEq<TraceId> for TraceId
impl Copy for TraceId
impl Eq for TraceId
impl StructuralEq for TraceId
impl StructuralPartialEq for TraceId
Auto Trait Implementations
impl RefUnwindSafe for TraceId
impl Send for TraceId
impl Sync for TraceId
impl Unpin for TraceId
impl UnwindSafe for TraceId
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.