pub struct DecisionId(/* private fields */);Expand description
128-bit identifier linking a runtime decision to its EvidenceLedger entry.
Structurally identical to TraceId but semantically distinct.
Implementations§
Source§impl DecisionId
impl DecisionId
Sourcepub const fn from_parts(ts_ms: u64, random: u128) -> Self
pub const fn from_parts(ts_ms: u64, random: u128) -> Self
Create from millisecond timestamp and random bits.
ts_ms is saturated to the 48-bit field (matching
TraceId::from_parts) so an out-of-range value — e.g. microseconds
or nanoseconds passed by a unit-error — never silently corrupts the
“high 48 = ts, low 80 = random” layout. Without saturation,
(ts_ms as u128) << 80 shifts the top bits of an out-of-range ts_ms
off the 128-bit word, so timestamp_ms would return a truncated value.
Use Self::try_from_parts for a strict, error-returning surface.
(br-asupersync-rxe2sg)
Sourcepub const fn try_from_parts(ts_ms: u64, random: u128) -> Result<Self, u64>
pub const fn try_from_parts(ts_ms: u64, random: u128) -> Result<Self, u64>
Strict variant of Self::from_parts (br-asupersync-rxe2sg).
Returns Err(ts_ms) when the millisecond timestamp does not fit in the
48-bit field, mirroring TraceId::try_from_parts.
§Errors
Returns Err(ts_ms) if ts_ms >= 2^48.
Sourcepub const fn timestamp_ms(self) -> u64
pub const fn timestamp_ms(self) -> u64
Extract the millisecond timestamp.
Sourcepub const fn from_bytes(bytes: [u8; 16]) -> Self
pub const fn from_bytes(bytes: [u8; 16]) -> Self
Construct from big-endian bytes.
Trait Implementations§
Source§impl Clone for DecisionId
impl Clone for DecisionId
Source§fn clone(&self) -> DecisionId
fn clone(&self) -> DecisionId
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DecisionId
Source§impl Debug for DecisionId
impl Debug for DecisionId
Source§impl<'de> Deserialize<'de> for DecisionId
impl<'de> Deserialize<'de> for DecisionId
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for DecisionId
impl Display for DecisionId
impl Eq for DecisionId
Source§impl FromStr for DecisionId
impl FromStr for DecisionId
Source§impl Hash for DecisionId
impl Hash for DecisionId
Source§impl Ord for DecisionId
impl Ord for DecisionId
Source§fn cmp(&self, other: &DecisionId) -> Ordering
fn cmp(&self, other: &DecisionId) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for DecisionId
impl PartialEq for DecisionId
Source§fn eq(&self, other: &DecisionId) -> bool
fn eq(&self, other: &DecisionId) -> bool
self and other values to be equal, and is used by ==.