pub enum DurationUnitError {
Overflow {
multiplier: u64,
},
UnknownUnit,
}Expand description
Typed outcome of dispatching a validated integer magnitude through the
shared {ms, s, "", m, h} → Duration unit table.
Returned by duration_from_integer_magnitude_and_unit so each
typed-duration codec (limits::parse_duration backing :limits :wall-clock, supervisor::duration_codec::parse backing the shared
:supervisor :restart-window / :politicas :timeout /
:politicas :circuit-breaker :window duration slots) maps the axis-
agnostic outcome onto its own axis-specific error variant. The
closed-set discriminants (Overflow /
UnknownUnit) partition the two
diagnostic classes each caller distinguishes today:
Overflow { multiplier }— the accepted unit’snum × multiplierconversion overflowsu64::MAX.multiplieris the same literal the pre-lift arm’s diagnostic named verbatim (60for"m",3600for"h"), so each caller reconstructs the exact pre-lift wording ("…overflows u64 (magnitude × 60 > 2^64-1)") from the discriminant + its own magnitude/unit locals. The"ms"/"s"/""arms cannot overflow (everyu64maps to a representableDurationviafrom_millis/from_secs) so nomultipliervariant carries those units.UnknownUnit— the trimmed unit suffix is not in the accepted set{"ms", "s", "", "m", "h"}. Each caller wraps the unit verbatim in its ownUnknownDurationUnit/"unknown duration unit"diagnostic.
Lifted to a pub enum next to duration_from_integer_magnitude_and_unit
so the accepted-unit set + the multiplier table + the overflow-
arm partition live in exactly one place across every typed-duration
codec in caixa-core. A future unit addition (a "us" microsecond
suffix once high-resolution timing lands, a "d" day suffix once
downstream K8s CR schemas grow multi-day windows) extends this
enum + its associated match arm at one site rather than at each
codec’s inline dispatch.
Variants§
Overflow
The num × multiplier seconds-conversion overflows u64::MAX.
multiplier names the exact literal each caller’s pre-lift
diagnostic embedded (60 for the minute arm, 3600 for the
hour arm), so callers reconstruct the wording losslessly.
Fields
UnknownUnit
The trimmed unit suffix is not in the accepted set
{"ms", "s", "", "m", "h"}.
Trait Implementations§
Source§impl Clone for DurationUnitError
impl Clone for DurationUnitError
Source§fn clone(&self) -> DurationUnitError
fn clone(&self) -> DurationUnitError
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 DurationUnitError
Source§impl Debug for DurationUnitError
impl Debug for DurationUnitError
impl Eq for DurationUnitError
Source§impl PartialEq for DurationUnitError
impl PartialEq for DurationUnitError
impl StructuralPartialEq for DurationUnitError
Auto Trait Implementations§
impl Freeze for DurationUnitError
impl RefUnwindSafe for DurationUnitError
impl Send for DurationUnitError
impl Sync for DurationUnitError
impl Unpin for DurationUnitError
impl UnsafeUnpin for DurationUnitError
impl UnwindSafe for DurationUnitError
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> 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.