pub trait PhaseLabel:
Clone
+ PartialEq
+ 'static {
const ALL: &'static [Self];
// Required methods
fn label(&self) -> &str;
fn unknown(raw: String) -> Self;
// Provided methods
fn parse(s: &str) -> Option<Self> { ... }
fn canonical() -> Vec<&'static str> { ... }
}Expand description
A lifecycle-phase enum that can be rendered as a metric label.
The single source of truth for a CRD’s phase labels: PhaseLabel::ALL
enumerates every canonical variant and PhaseLabel::label is an
exhaustive match. The controller’s kopiur_resource_phase gauge uses these
to set the active phase to 1 and the rest to 0 (and to clear all on
deletion), so both the label string and the reset set come from the enum
itself rather than a stringly-typed table that can silently drift
(ADR §5.5 type-safety thesis).
Every phase enum also carries an Unknown(String) decode-compat variant
(see the crate-internal phase_serde! macro below). It is deliberately absent
from PhaseLabel::ALL: ALL is the CRD schema’s admissible set and the
metric label domain, whereas Unknown only ever comes back off the wire
from a newer operator’s write. label() therefore returns &str, not
&'static str — Unknown echoes the stored string verbatim.
Required Associated Constants§
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".