pub enum CostPhase {
ImageBuild,
ImageStorage,
Launch,
Running,
Suspended,
Suspend,
Resume,
}Expand description
The lifecycle a sandbox goes through, as the phases that cost money.
Variants§
Implementations§
Source§impl CostPhase
impl CostPhase
Sourcepub const ALL: [CostPhase; 7]
pub const ALL: [CostPhase; 7]
Every phase, in lifecycle order.
Public because a caller that has to judge a phase string needs the list to
refuse with, and the two bindings each grew their own copy of this array before
it existed here — a parallel table that would have gone stale the first time a
phase was added. CostPhase::from_str is the reader; the round-trip test below
is what stops a variant being added to the enum and forgotten here.
Trait Implementations§
impl Copy for CostPhase
Source§impl Display for CostPhase
pad rather than write_str, because a phase is a column.
impl Display for CostPhase
pad rather than write_str, because a phase is a column.
write_str ignores the formatter’s width entirely, so {:<14} on a phase silently
produced a ragged table — every plain-text line’s dollar figure started at a
different offset, and the fix looks like it is already there in the format string.
fmt::Formatter::pad is the one spelling that honours width, precision, and
alignment; write!(f, "{}", ...) here would recurse straight back into this
impl and drop the width again.
impl Eq for CostPhase
Source§impl FromStr for CostPhase
impl FromStr for CostPhase
Source§fn from_str(phase: &str) -> Result<CostPhase, Error>
fn from_str(phase: &str) -> Result<CostPhase, Error>
A phase from its wire spelling, refusing anything else with the whole list.
Here rather than in each caller because the callers are bindings: a Python or
JS report.by_phase("running") has a bare string where Rust has a variant, so
something has to judge it. Both bindings did, each with its own seven-element
array — two parallel tables over a closed set, which is one table too many and
two too many to keep in step with the enum. This is the single reader, and the
list it offers on a refusal is CostPhase::ALL rather than a written-out
sentence, so a phase added to the enum appears in the message without an edit.
Note the asymmetry with Region::from_str: a region’s refusal
exists because an unlisted region is a plausible value this client has no
evidence for, and there is an opt-in. A phase has no opt-in and needs none — the
set is closed by the billing model, so an unrecognized spelling is a typo and
nothing more.
impl StructuralPartialEq for CostPhase
Auto Trait Implementations§
impl Freeze for CostPhase
impl RefUnwindSafe for CostPhase
impl Send for CostPhase
impl Sync for CostPhase
impl Unpin for CostPhase
impl UnsafeUnpin for CostPhase
impl UnwindSafe for CostPhase
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more