pub struct PhysicalMs(/* private fields */);Expand description
A u64 physical-millisecond value proven <= PHYSICAL_MS_MAX at
construction.
The 46-bit physical field of Timestamp cannot represent any value above
PHYSICAL_MS_MAX; every allocator entry point used to re-check that
bound on bare u64 parameters (fence_floor, committed_ceiling,
now_ms, persisted_high_water) — three different methods, each carrying
its own if value > PHYSICAL_MS_MAX { ... } line. PhysicalMs collapses
those per-method runtime checks into one construction-site check, so:
- a method signature taking
PhysicalMsis compile-time proof that the 46-bit bound has already been validated for that argument; and - an accidental swap of
now_msandcommitted_ceilingat a call site no longer type-checks against bareu64clocks, durations, or counters.
Constructed via try_new (or the equivalent
TryFrom<u64> impl). The inner value can be recovered with
get for arithmetic; the result must be re-wrapped through
try_new before crossing back into a PhysicalMs-typed boundary.
Implementations§
Source§impl PhysicalMs
impl PhysicalMs
Sourcepub const MAX: PhysicalMs
pub const MAX: PhysicalMs
The largest in-range value, 2^46 - 1 (equal to PHYSICAL_MS_MAX).
Sourcepub const ZERO: PhysicalMs
pub const ZERO: PhysicalMs
The zero value. Available as const, matching Duration::ZERO style.
Sourcepub const fn try_new(value: u64) -> Result<Self, CoreError>
pub const fn try_new(value: u64) -> Result<Self, CoreError>
Validate value <= PHYSICAL_MS_MAX and wrap. Returns
CoreError::PhysicalMsOutOfRange otherwise.
Declared const fn so MAX and any other compile-time
PhysicalMs constant can be built without unsafe direct-field
construction outside this module.
Trait Implementations§
Source§impl Clone for PhysicalMs
impl Clone for PhysicalMs
Source§fn clone(&self) -> PhysicalMs
fn clone(&self) -> PhysicalMs
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PhysicalMs
impl Debug for PhysicalMs
Source§impl Default for PhysicalMs
impl Default for PhysicalMs
Source§fn default() -> PhysicalMs
fn default() -> PhysicalMs
Source§impl Display for PhysicalMs
impl Display for PhysicalMs
Source§impl Hash for PhysicalMs
impl Hash for PhysicalMs
Source§impl Ord for PhysicalMs
impl Ord for PhysicalMs
Source§fn cmp(&self, other: &PhysicalMs) -> Ordering
fn cmp(&self, other: &PhysicalMs) -> 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 PhysicalMs
impl PartialEq for PhysicalMs
Source§fn eq(&self, other: &PhysicalMs) -> bool
fn eq(&self, other: &PhysicalMs) -> bool
self and other values to be equal, and is used by ==.