pub struct PhaseId { /* private fields */ }Expand description
A phase identifier — a major number, optionally with a minor number.
Ordering is (major, minor) with an absent minor sorting first, so
35 < 35.1 < 35.2 < 36.
Implementations§
Source§impl PhaseId
impl PhaseId
Sourcepub const fn with_minor(major: u32, minor: u32) -> Self
pub const fn with_minor(major: u32, minor: u32) -> Self
A decimal-numbered phase, e.g. 35.1.
Sourcepub fn from_json(value: Option<&Value>) -> Option<Self>
pub fn from_json(value: Option<&Value>) -> Option<Self>
Reads a phase field out of a persisted JSON record, in either shape
— a bare number (written before the widening, and still what an
integer phase writes) or a string.
Returns None when the field is absent or is neither shape. Callers
index rather than defaulting, so an absent field cannot read as a
phase that happens to match.
Sourcepub fn matches_json(self, value: Option<&Value>) -> bool
pub fn matches_json(self, value: Option<&Value>) -> bool
Whether a persisted JSON phase field denotes this phase.
The minor number is part of the identity: phase 35’s records must
not match phase 35.1, which is the same cross-matching hazard the
artifact glob has.
Trait Implementations§
impl Copy for PhaseId
Source§impl<'de> Deserialize<'de> for PhaseId
impl<'de> Deserialize<'de> for PhaseId
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Accepts either shape: a bare number (state files written before the
widening) or a string ("35.1").
impl Eq for PhaseId
Source§impl Ord for PhaseId
impl Ord for PhaseId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for PhaseId
impl PartialOrd for PhaseId
Source§impl Serialize for PhaseId
impl Serialize for PhaseId
Source§fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>
Serializes an integer phase as a JSON number and a decimal phase as a string.
The number arm preserves the on-disk shape of every state-NN.json
written before the widening, so an existing run is not disturbed by
this change.
impl StructuralPartialEq for PhaseId
Auto Trait Implementations§
impl Freeze for PhaseId
impl RefUnwindSafe for PhaseId
impl Send for PhaseId
impl Sync for PhaseId
impl Unpin for PhaseId
impl UnsafeUnpin for PhaseId
impl UnwindSafe for PhaseId
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.