pub struct RequestId { /* private fields */ }Expand description
128-bit request identifier rendered as RFC 4122 UUIDv4.
Implementations§
Source§impl RequestId
impl RequestId
Sourcepub fn from_pair(high: u64, low: u64) -> Self
pub fn from_pair(high: u64, low: u64) -> Self
Construct a RequestId from raw 64-bit halves, applying the UUIDv4
version (0x4) and variant (0b10) bits.
Sourcepub fn from_hex(s: &str) -> Option<Self>
pub fn from_hex(s: &str) -> Option<Self>
Parse a 32-char hex string (no dashes) back into a RequestId.
Returns None if the input is malformed.
Sourcepub fn from_uuid(s: &str) -> Option<Self>
pub fn from_uuid(s: &str) -> Option<Self>
Parse a UUID-formatted string (with dashes) back into a RequestId.
Sourcepub fn as_bytes(&self) -> [u8; 16]
pub fn as_bytes(&self) -> [u8; 16]
Return the raw 16 bytes of this request id in big-endian order (high half first).
Equivalent to [high.to_be_bytes(), low.to_be_bytes()].concat(),
without an allocation. Useful for binary protocols that store
request ids alongside other binary payloads.
Sourcepub fn from_bytes(bytes: [u8; 16]) -> Self
pub fn from_bytes(bytes: [u8; 16]) -> Self
Reconstruct a RequestId from its 16-byte big-endian representation.
Note: this preserves the bytes as-is (UUIDv4 version + variant nibbles
are NOT re-imposed), so round-tripping through as_bytes -> from_bytes
yields the same id. To enforce the v4 layout from arbitrary bytes,
pipe through RequestId::from_pair explicitly.
Trait Implementations§
impl Copy for RequestId
impl Eq for RequestId
impl StructuralPartialEq for RequestId
Auto Trait Implementations§
impl Freeze for RequestId
impl RefUnwindSafe for RequestId
impl Send for RequestId
impl Sync for RequestId
impl Unpin for RequestId
impl UnsafeUnpin for RequestId
impl UnwindSafe for RequestId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more