pub enum RestartPolicy {
Permanent,
Temporary,
Transient,
}Expand description
Per-child restart policy.
Permanent / Temporary / Transient match Erlang/OTP semantics 1:1.
Variants§
Permanent
Always restart the child, regardless of how it died. Used for long-running services that must always be up.
Temporary
Never restart. Used for one-shot work whose completion is
itself the success signal (oneShot triggers map here).
Transient
Restart only when the child died abnormally (non-zero exit or unhandled exception). A clean exit completes the child.
Implementations§
Source§impl RestartPolicy
impl RestartPolicy
Sourcepub const fn discriminant(&self) -> &'static str
pub const fn discriminant(&self) -> &'static str
Stable variant discriminant — auto-generated by
#[derive(Discriminant)]. The string IS the wire
identifier for metrics labels / audit-log tags /
rate-limit keys; renaming an existing variant is a
breaking change.
Source§impl RestartPolicy
impl RestartPolicy
pub const fn is_permanent(&self) -> bool
pub const fn is_temporary(&self) -> bool
pub const fn is_transient(&self) -> bool
Source§impl RestartPolicy
impl RestartPolicy
Sourcepub const ALL: &'static [Self]
pub const ALL: &'static [Self]
Exhaustive iteration surface for every consumer that walks the
closed three-arm RestartPolicy discriminator set (the future
M4 mesh.pleme.io/v1alpha1/Supervisor CR materializer’s
per-child admission-webhook rejection body naming the accepted-
:restart list, a future feira supervisor --restart … CLI
arg-parse’s “did you mean” hint via a Self::from_wire-scan
over the slice, the future feira app graph per-child restart
column, any future round-trip fuzz harness that sweeps every
arm). A future arm addition (an OTP-intrinsic fourth arm the
theory
ABSORPTION-ROADMAP
might reach for once the three canonical OTP restart policies
stop covering the substrate’s discovered load-shape) extends
this slice as one edit and every consumer picks up the new entry
by construction; the compiler-checked exhaustiveness on the
sibling method match arms (Self::as_str / Self::from_wire)
is the build-time guarantee that no arm forgets to grow.
Peer of the sibling closed-set typed enums’
RestartStrategy::ALL (4eec29c) /
crate::CaixaKind::ALL (6b1f4fb) /
crate::aplicacao::PlacementStrategy::ALL (18c7342) /
crate::aplicacao::RateLimitUnit::ALL (6bce03d) /
crate::dep::DepList::ALL (45ee563) exhaustive-iteration
surfaces — the sixth (and the third and final M2 OTP-shape)
closed-set typed enum on the caixa surface to converge onto the
same one-canonical-arm-list-per-enum discipline. Sibling axis to
the peer RestartStrategy::ALL on the per-supervisor
sibling-restart-strategy axis; this closes the per-child
restart-decision-policy axis on the same M2 :supervisor slot.
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
Canonical PascalCase discriminator scalar this variant serializes
as under crate::render::SUPERVISOR_CHILD_KEY_RESTART. The three
arms return the paired
crate::render::SUPERVISOR_CHILD_RESTART_PERMANENT /
crate::render::SUPERVISOR_CHILD_RESTART_TEMPORARY /
crate::render::SUPERVISOR_CHILD_RESTART_TRANSIENT lifted
constants so every substrate consumer that dispatches on the
per-child restart-decision policy (the future wasm-operator’s
per-child post-exit restart-decision branch, the future M4
mesh.pleme.io/v1alpha1/Supervisor CR materializer’s
admission-time enum-arm bind, the caixa-operator’s hierarchical
reconciliation scheduler’s per-child-policy fan-out) reads the
same byte-string the Serialize derive emits — the pin test in
[tests::restart_policy_variants_serialize_to_lifted_scalar_values]
asserts the two paths agree, peer of the M2
RestartStrategy::as_str (09ffb2d) on the sibling per-supervisor
sibling-restart-strategy axis and the M3
crate::aplicacao::PlacementStrategy::as_str (cc8f749) on the
per-Aplicacao distribution-strategy axis — the third of three
OTP-shaped closed-enum discriminator axes on the caixa typed
surface to converge onto the same three-path-convergence
(Serialize derive → as_str helper → lifted constant)
drift-detection posture.
Sourcepub fn from_wire(s: &str) -> Option<Self>
pub fn from_wire(s: &str) -> Option<Self>
Substrate-canonical reverse projection on the :children :restart
closed-set axis — parses the PascalCase discriminator scalar
back to the typed variant, or None when s is outside the
closed-set arm-string set Self::as_str emits. Dispatches on
the same lifted
crate::render::SUPERVISOR_CHILD_RESTART_PERMANENT /
crate::render::SUPERVISOR_CHILD_RESTART_TEMPORARY /
crate::render::SUPERVISOR_CHILD_RESTART_TRANSIENT constants
the Self::as_str emitter walks, so the parse and emit halves
of the round-trip migrate through one caixa-core edit on any
future arm addition.
Prior to this lift the substrate carried only the forward
Self → &str projection on the OTP per-child restart-policy
axis (the Self::as_str emitter, the std::fmt::Display
impl routed through it, the Serialize derive that emits the
same byte-string under crate::render::SUPERVISOR_CHILD_KEY_RESTART)
plus the kebab-case dispatcher-catalog identity via
Self::discriminant — every non-serde consumer that wanted to
parse a wire-form PascalCase policy scalar had to re-inline a
three-arm match s { "Permanent" => …, "Temporary" => …, "Transient" => …, _ => … } cascade that expressed no
compile-time link back to the typed variant’s canonical lifted
constant. A future variant rename or per-arm serde-attribute
drift would silently split the wire byte-string one non-serde
consumer parsed from the one the emitter wrote, with the failure
surfacing at the operator’s reconcile posture (a :temporary
oneShot child being restarted on clean exit, treating the
successful-completion signal as failure and re-running the
completion-terminal one-shot indefinitely; a :transient child
that clean-exited being restarted, masking the clean-completion
contract) far from the rebrand commit and with no field naming
the drift.
Distinct axis from the std::str::FromStr impl the
gen_platform::FromStrKind derive already installs on this
enum by design, not by drift: FromStr parses the kebab-case
dispatcher-catalog identity ("permanent" / "temporary" /
"transient" — the inverse of Self::discriminant), while
this method inverts the PascalCase wire byte-string
Self::as_str emits. The two-axis split lets the dispatcher-
catalog identity live in kebab-case (where every peer catalog
identifier already lives) without forcing a wire-format rename
on the tatara-lisp author surface (:restart Permanent,
PascalCase) — the same two-axis distinction the sibling
RestartStrategy::from_wire (4eec29c) /
crate::CaixaKind::from_wire (2aa6d23) /
crate::aplicacao::PlacementStrategy::from_wire (18c7342)
carry on their peer closed-set typed-enum wire round-trips.
Same closed-set-reverse-projection discipline the sibling
RestartStrategy::from_wire (4eec29c) /
crate::CaixaKind::from_wire (2aa6d23) /
crate::aplicacao::PlacementStrategy::from_wire (18c7342) /
crate::aplicacao::RateLimitUnit::from_suffix typed enums
carry on the peer wire-side str → Self axes — extended onto
the M2 OTP-shape per-child restart-policy closed-set axis, the
sixth substrate-side closed-set typed enum (and the third and
final OTP-shape closed-enum discriminator axis) to converge on
the two-way str ↔ Self round-trip. Method-named from_wire
(not from_str) to match the peer RestartStrategy::from_wire
shape verbatim and side-step the std::str::FromStr impl the
derive already installs on the sibling kebab-case axis. Returns
Option<Self> (rather than Result<Self, _>) to match the peer
shapes: the caller picks the diagnostic form appropriate for
its use site.
Trait Implementations§
Source§impl AsRef<str> for RestartPolicy
Substrate-canonical AsRef<str> projection on the M2
per-child-restart-policy RestartPolicy closed-set typed enum —
routes through the same RestartPolicy::as_str pub const fn
scalar accessor the paired std::fmt::Display impl and the
un-renamed serde::Serialize derive already key off, so any
future consumer that binds a RestartPolicy through the
standard-library impl AsRef<str> bound (a future
[caixa-feira] feira supervisor --restart <arm> verb that
composes the emitted PascalCase wire scalar into a
std::process::Command::arg shell-out of the future
wasm-operator’s per-child admission gate, a per-child structured-
log recorder on the future caixa-operator’s hierarchical
reconciliation surface that accepts impl AsRef<str> at the
tracing::field::Value Str-arm, a std::collections::HashMap
lookup keyed on the restart-policy wire byte through
map.get::<str>(policy.as_ref()) on a future per-policy
dispatch table) reaches the paired
crate::render::SUPERVISOR_CHILD_RESTART_PERMANENT /
crate::render::SUPERVISOR_CHILD_RESTART_TEMPORARY /
crate::render::SUPERVISOR_CHILD_RESTART_TRANSIENT
lifted-const through one substrate-primitive dispatch rather
than an open-coded .as_str() projection at every wire-up.
impl AsRef<str> for RestartPolicy
Substrate-canonical AsRef<str> projection on the M2
per-child-restart-policy RestartPolicy closed-set typed enum —
routes through the same RestartPolicy::as_str pub const fn
scalar accessor the paired std::fmt::Display impl and the
un-renamed serde::Serialize derive already key off, so any
future consumer that binds a RestartPolicy through the
standard-library impl AsRef<str> bound (a future
[caixa-feira] feira supervisor --restart <arm> verb that
composes the emitted PascalCase wire scalar into a
std::process::Command::arg shell-out of the future
wasm-operator’s per-child admission gate, a per-child structured-
log recorder on the future caixa-operator’s hierarchical
reconciliation surface that accepts impl AsRef<str> at the
tracing::field::Value Str-arm, a std::collections::HashMap
lookup keyed on the restart-policy wire byte through
map.get::<str>(policy.as_ref()) on a future per-policy
dispatch table) reaches the paired
crate::render::SUPERVISOR_CHILD_RESTART_PERMANENT /
crate::render::SUPERVISOR_CHILD_RESTART_TEMPORARY /
crate::render::SUPERVISOR_CHILD_RESTART_TRANSIENT
lifted-const through one substrate-primitive dispatch rather
than an open-coded .as_str() projection at every wire-up.
Peer of the sibling std::fmt::Display impl on the same
primitive — both delegate to the shared RestartPolicy::as_str
pub const fn accessor, so [format!("{v}")], v.as_str(), and
<RestartPolicy as AsRef<str>>::as_ref(&v) resolve to the same
byte-string per instance by construction. A future variant rename
or #[serde(rename_all = "kebab-case")] attribute-drift on the
enum reaches every one of the three paths (plus the wire-format
Serialize derive that already routes through the same lifted
const) through exactly one caixa-core edit.
Same “route the trait impl through the substrate-primitive
accessor” discipline the sibling crate::CaixaVersion
AsRef<str> impl (16d5c7e) and the paired M2
RestartStrategy AsRef<str> impl (63eb1a4) carry — extends
the axis onto the paired per-child-restart-decision-policy
sibling on the same M2 :supervisor slot (the second M2
OTP-shape closed-set typed enum to converge onto the standard-
library AsRef<str> projection). Rust-side newtype/typed-enum
convention pairs AsRef<str> and [fmt::Display] on the same
primitive so a caller who has one has both; before this lift,
RestartPolicy carried [fmt::Display] but not the paired
AsRef<str> impl the convention names.
Pinned load-bearing by
[tests::restart_policy_as_ref_str_routes_through_as_str_accessor]
(byte-parity pin against RestartPolicy::as_str across the
three-arm closed set) and
[tests::restart_policy_as_ref_str_routes_through_display_via_shared_accessor]
(three-path convergence: AsRef<str> + Display + as_str all
resolve to the same lifted SUPERVISOR_CHILD_RESTART_* const per
arm) — any future silent detour that routes the impl through a
divergent projection (a per-arm inline match self { … }
re-inlining that opens a compile-time link to the un-lifted
arm-literal, a swap onto the kebab-case
gen_platform::Discriminant catalog identity that would
collide the wire axis with the dispatcher-catalog axis) trips at
caixa-core test time under assert_eq! rather than at a
downstream impl AsRef<str>-bound consumer’s silent split.
Source§impl Clone for RestartPolicy
impl Clone for RestartPolicy
Source§fn clone(&self) -> RestartPolicy
fn clone(&self) -> RestartPolicy
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 RestartPolicy
Source§impl Debug for RestartPolicy
impl Debug for RestartPolicy
Source§impl Default for RestartPolicy
impl Default for RestartPolicy
Source§impl<'de> Deserialize<'de> for RestartPolicy
impl<'de> Deserialize<'de> for RestartPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for RestartPolicy
std::fmt::Display routed through RestartPolicy::as_str, so the
pretty-printed byte-string every consumer that formats the policy as
user-facing text lands on (the future wasm-operator’s per-child
post-exit restart-decision diagnostic line, the future feira app graph per-child restart column, the future M4
mesh.pleme.io/v1alpha1/Supervisor CR materializer’s per-child
admission-webhook rejection body) reaches for the same lifted
crate::render::SUPERVISOR_CHILD_RESTART_PERMANENT /
crate::render::SUPERVISOR_CHILD_RESTART_TEMPORARY /
crate::render::SUPERVISOR_CHILD_RESTART_TRANSIENT const the
wire-format Serialize derive already emits under
crate::render::SUPERVISOR_CHILD_KEY_RESTART and the
RestartPolicy::as_str helper already returns.
impl Display for RestartPolicy
std::fmt::Display routed through RestartPolicy::as_str, so the
pretty-printed byte-string every consumer that formats the policy as
user-facing text lands on (the future wasm-operator’s per-child
post-exit restart-decision diagnostic line, the future feira app graph per-child restart column, the future M4
mesh.pleme.io/v1alpha1/Supervisor CR materializer’s per-child
admission-webhook rejection body) reaches for the same lifted
crate::render::SUPERVISOR_CHILD_RESTART_PERMANENT /
crate::render::SUPERVISOR_CHILD_RESTART_TEMPORARY /
crate::render::SUPERVISOR_CHILD_RESTART_TRANSIENT const the
wire-format Serialize derive already emits under
crate::render::SUPERVISOR_CHILD_KEY_RESTART and the
RestartPolicy::as_str helper already returns.
Pre-convergence the two paths structurally disagreed — the
#[derive(gen_platform::Discriminant)] + #[discriminant(also_display)]
route (now retired here) sent std::fmt::Display through the
gen-platform discriminant catalog string, which arrives kebab-case as
"permanent" / "temporary" / "transient" on this three-arm enum
(whose variant names each collapse to their own lowercase form under
the kebab-case transform), while the wire format ran as PascalCase
"Permanent" / "Temporary" / "Transient" through the un-renamed
serde derive. Every consumer that formatted the policy for a
diagnostic line, a graph column, or a rejection body under
format!("{v}") therefore landed under a different byte-string than
the wire format the operator’s per-child-policy dispatch keyed off —
a silent split whose apply-time symptom (a format!("{v}")-carrying
diagnostic quoting "permanent" while the wire scalar the operator
probed was "Permanent") surfaced as a confused correlate at
operator-log time far from the two-declaration site.
Routing Display through RestartPolicy::as_str closes the third
path: every format!("{v}") call reaches the same lifted
[crate::render::SUPERVISOR_CHILD_RESTART_*] const the wire format
and the RestartPolicy::as_str helper route through — Debug (the
compiler-derived variant name), Display (via as_str), and Serialize
(via the un-renamed derive) all resolve to the same PascalCase
byte-string per variant. A future variant rename or
#[serde(rename_all = "kebab-case")] attribute reaches every path at
exactly one place, structurally.
The dispatcher-catalog identity remains kebab-case — Self::discriminant
(from #[derive(gen_platform::Discriminant)]) still returns
"permanent" / "temporary" / "transient", and the fleet-wide
[gen_platform::register_dispatcher!("caixa.restart-policy", …)]
registration keys the catalog off the same kebab identity. The two
naming worlds now live on separate typed methods (Display /
as_str for the wire byte-string, discriminant for the catalog
identity) rather than sharing one Display route that structurally
disagrees with the wire format.
Pin tests
[tests::restart_policy_display_routes_through_as_str_helper]
and
[tests::restart_policy_display_matches_serialized_wire_byte_string]
assert the three paths agree byte-for-byte on every variant, so a
future variant rename or per-arm serde attribute drift is a build
error visible at caixa-core test time, not a silent per-consumer
dispatch miss at apply / reconcile time.
Mirrors the M3 crate::aplicacao::PlacementStrategy Display impl
(aplicacao.rs:2306) on the per-Aplicacao distribution-strategy axis
and the sibling RestartStrategy Display impl on the
per-supervisor sibling-restart-strategy axis — same three-path-
convergence discipline, extended to close the third and final of
three OTP-shaped closed-enum discriminator axes on the caixa typed
surface.
impl Eq for RestartPolicy
Source§impl From<&RestartPolicy> for &'static str
Trait-idiomatic forward projection on RestartPolicy from a
borrowed input onto the &'static str axis — the borrowed-input
companion to the paired owned-input [From<RestartPolicy> for &'static str] impl immediately above. Routes byte-for-byte through
the same substrate-primitive RestartPolicy::as_str pub const fn accessor so every consumer that binds a &RestartPolicy
through the standard-library .into() / [From<&Self> for &'static str] axis (a RestartPolicy::ALL.iter().map(<&'static str>::from).collect::<Vec<_>>() per-arm accept-set materializer —
whose iterator over &'static [RestartPolicy] yields
&RestartPolicy, not RestartPolicy, so the owned-input
From<RestartPolicy> axis alone forces every call site through
an explicit .copied() / dereference / Copy-bound restatement
rather than the direct trait-idiomatic projection; a future generic
<T: Copy + for<'a> Into<&'static str>>-bound diagnostic column
that walks the iter().map(Into::into) shape verbatim across every
substrate-wide closed-set typed enum; the future wasm-operator’s
per-child post-exit restart-decision diagnostic line that composes
the accepted-set enumeration from an iterated
RestartPolicy::ALL.iter().map(|p| p.into()) pipe rather than a
per-arm match p { … } cascade; a future
HashMap::<&'static str, RestartPolicy>::from_iter( RestartPolicy::ALL.iter().map(|p| (p.into(), *p)))-style
per-policy reverse-lookup table the sibling TryFrom<&str> impl
cannot compose without this borrowed-input axis in place) reaches
the same three-arm lifted
crate::render::SUPERVISOR_CHILD_RESTART_PERMANENT /
crate::render::SUPERVISOR_CHILD_RESTART_TEMPORARY /
crate::render::SUPERVISOR_CHILD_RESTART_TRANSIENT const the
paired owned-input [From<RestartPolicy> for &'static str], the
sibling std::fmt::Display, AsRef<str>, and
RestartPolicy::as_str surfaces already return.
impl From<&RestartPolicy> for &'static str
Trait-idiomatic forward projection on RestartPolicy from a
borrowed input onto the &'static str axis — the borrowed-input
companion to the paired owned-input [From<RestartPolicy> for &'static str] impl immediately above. Routes byte-for-byte through
the same substrate-primitive RestartPolicy::as_str pub const fn accessor so every consumer that binds a &RestartPolicy
through the standard-library .into() / [From<&Self> for &'static str] axis (a RestartPolicy::ALL.iter().map(<&'static str>::from).collect::<Vec<_>>() per-arm accept-set materializer —
whose iterator over &'static [RestartPolicy] yields
&RestartPolicy, not RestartPolicy, so the owned-input
From<RestartPolicy> axis alone forces every call site through
an explicit .copied() / dereference / Copy-bound restatement
rather than the direct trait-idiomatic projection; a future generic
<T: Copy + for<'a> Into<&'static str>>-bound diagnostic column
that walks the iter().map(Into::into) shape verbatim across every
substrate-wide closed-set typed enum; the future wasm-operator’s
per-child post-exit restart-decision diagnostic line that composes
the accepted-set enumeration from an iterated
RestartPolicy::ALL.iter().map(|p| p.into()) pipe rather than a
per-arm match p { … } cascade; a future
HashMap::<&'static str, RestartPolicy>::from_iter( RestartPolicy::ALL.iter().map(|p| (p.into(), *p)))-style
per-policy reverse-lookup table the sibling TryFrom<&str> impl
cannot compose without this borrowed-input axis in place) reaches
the same three-arm lifted
crate::render::SUPERVISOR_CHILD_RESTART_PERMANENT /
crate::render::SUPERVISOR_CHILD_RESTART_TEMPORARY /
crate::render::SUPERVISOR_CHILD_RESTART_TRANSIENT const the
paired owned-input [From<RestartPolicy> for &'static str], the
sibling std::fmt::Display, AsRef<str>, and
RestartPolicy::as_str surfaces already return.
Fifth peer on the substrate-wide trait-idiomatic borrowed-input
forward-projection family opened on crate::dep::DepList
(64aa742) and extended onto crate::CaixaKind (5ab993a),
crate::CaixaDialeto (807b0b5), and the paired
per-supervisor sibling-restart-strategy RestartStrategy
(e941836). Rust’s From trait does not auto-derive the
From<&Self> sibling from a From<Self> impl (the blanket
impl<T, U> From<&T> for U where T: Copy, U: From<T> does not
exist in core), so every closed-set typed enum that carries the
owned-input axis but not the borrowed-input axis forces every
borrowed-input call site through a .copied() /
<&'static str>::from(*policy) / policy.as_str() detour whose
type bounds have no compile-time link to the substrate primitive.
RestartPolicy is the second (and second-of-two-in-M2)
OTP-shape peer to converge onto this campaign — sibling of the
paired per-supervisor RestartStrategy borrowed-input axis, so
with this lift both closed-set typed enums on the M2 :supervisor
slot now carry the full sibling quintet (std::fmt::Display,
AsRef<str>, [Self::as_str], From<Self> for &'static str,
From<&Self> for &'static str) plus the paired trait-idiomatic
reverse projection TryFrom<&str>, closing the borrowed-input
forward-projection axis on the M2 OTP-shape slot as a unit.
Same three-path convergence discipline as the paired owned-input
impl (this borrowed-input axis, the paired owned-input
[From<RestartPolicy> for &'static str], and
RestartPolicy::as_str all route through the same lifted
[crate::render::SUPERVISOR_CHILD_RESTART_*] const), so a future
variant rename or per-arm serde-attribute drift reaches every one
of the six sibling forward-projection paths
(std::fmt::Display, AsRef<str>, [Self::as_str],
[From<Self> for &'static str], this [From<&Self> for &'static str], and the un-renamed serde::Serialize derive that also
emits [Self::as_str]’s bytes) through exactly one caixa-core
edit.
The RestartPolicy::as_str emit and RestartPolicy::from_wire
parse share the same PascalCase vocabulary by construction, so
the borrowed-input forward axis and the reverse axis compose
directly — the round-trip witness pin below locks this direct
composition without the intermediate wire-vocab hop the peer
crate::CaixaKind axis pair requires.
Pinned load-bearing by
[tests::restart_policy_from_borrowed_into_static_str_routes_through_as_str_accessor]
(byte-parity pin against RestartPolicy::as_str across the
three-arm emit-set via a borrowed input, plus a const-context
materialization witness for the &'static str lifetime promise,
plus a blanket .into() shape) and
[tests::restart_policy_from_owned_and_borrowed_into_static_str_agree_on_every_arm]
(cross-axis partition pin against the paired owned-input
[From<RestartPolicy> for &'static str] impl, plus a
.iter().map(Into::into) pipe witness over
RestartPolicy::ALL, plus a direct round-trip witness through
TryFrom<&str> that closes the two-way &Self → &'static str → Self round-trip without the wire-vocab intermediate the peer
crate::CaixaKind axis pair requires).
Source§fn from(policy: &RestartPolicy) -> &'static str
fn from(policy: &RestartPolicy) -> &'static str
Source§impl From<&RestartPolicy> for String
Trait-idiomatic borrowed-input, owned-String output forward
projection on the second-of-two M2 OTP-shape closed-set typed enum
(RestartPolicy) — the fourth (and closing) corner of the
{Self, &Self} × {&'static str, String} 2×2 trait-idiomatic
projection family on this enum, mirror of the first-mover
[From<&RestartStrategy> for String] (579385f) that opened the
2×2-completion corner on the sibling supervisor-level strategy
enum. Routes byte-for-byte through the substrate-primitive
RestartPolicy::as_str pub const fn accessor (via
str::to_owned) so every consumer that holds a borrowed
[&RestartPolicy] and needs an owned String — a future
serde_json::Value::String(String::from(&policy)) structured-payload
composer over a borrowed field, a future Iterator::map over
&[RestartPolicy] that projects to owned keys through
.iter().map(String::from), a future HashMap::<String, RestartPolicy>::from_iter that keys off a borrowed-iteration axis
where dereferencing the policy would force an unnecessary Copy at
every step, the future wasm-operator’s per-supervisor
child_policies.iter().map(String::from).collect() per-child post-
exit restart-decision diagnostic emit whose iteration axis is
borrowed by construction — reaches the same three-arm lifted
crate::render::SUPERVISOR_CHILD_RESTART_PERMANENT /
crate::render::SUPERVISOR_CHILD_RESTART_TEMPORARY /
crate::render::SUPERVISOR_CHILD_RESTART_TRANSIENT const the
paired std::fmt::Display, AsRef<str>,
RestartPolicy::as_str, and the three other trait-idiomatic
forward-projection impls
([From<RestartPolicy> for &'static str],
[From<&RestartPolicy> for &'static str],
[From<RestartPolicy> for String]) already return.
impl From<&RestartPolicy> for String
Trait-idiomatic borrowed-input, owned-String output forward
projection on the second-of-two M2 OTP-shape closed-set typed enum
(RestartPolicy) — the fourth (and closing) corner of the
{Self, &Self} × {&'static str, String} 2×2 trait-idiomatic
projection family on this enum, mirror of the first-mover
[From<&RestartStrategy> for String] (579385f) that opened the
2×2-completion corner on the sibling supervisor-level strategy
enum. Routes byte-for-byte through the substrate-primitive
RestartPolicy::as_str pub const fn accessor (via
str::to_owned) so every consumer that holds a borrowed
[&RestartPolicy] and needs an owned String — a future
serde_json::Value::String(String::from(&policy)) structured-payload
composer over a borrowed field, a future Iterator::map over
&[RestartPolicy] that projects to owned keys through
.iter().map(String::from), a future HashMap::<String, RestartPolicy>::from_iter that keys off a borrowed-iteration axis
where dereferencing the policy would force an unnecessary Copy at
every step, the future wasm-operator’s per-supervisor
child_policies.iter().map(String::from).collect() per-child post-
exit restart-decision diagnostic emit whose iteration axis is
borrowed by construction — reaches the same three-arm lifted
crate::render::SUPERVISOR_CHILD_RESTART_PERMANENT /
crate::render::SUPERVISOR_CHILD_RESTART_TEMPORARY /
crate::render::SUPERVISOR_CHILD_RESTART_TRANSIENT const the
paired std::fmt::Display, AsRef<str>,
RestartPolicy::as_str, and the three other trait-idiomatic
forward-projection impls
([From<RestartPolicy> for &'static str],
[From<&RestartPolicy> for &'static str],
[From<RestartPolicy> for String]) already return.
Second peer on the substrate-wide trait-idiomatic borrowed-input,
owned-String output forward-projection family opened on
crate::supervisor::RestartStrategy (579385f) — closes the
{Self, &Self} × {&'static str, String} 2×2 projection corner on
both M2 OTP-shape sibling peers (the paired supervisor-level
sibling-restart-strategy axis and the per-child restart-decision-
policy axis), so the whole M2 OTP-shape axis pair now carries the
full four-corner family by construction. Rust’s standard library
does not carry a blanket impl<T: AsRef<str>> From<&T> for String
(nor an impl<T: fmt::Display> From<&T> for String), so every
closed-set typed enum that carries the paired AsRef<str> /
Display / From<Self> for &'static str / From<&Self> for &'static str / From<Self> for String quintuple but not the
borrowed-input owned-String axis forces every borrowed-input
owned-string call site through a policy.as_str().to_owned() /
String::from(*policy) (with a spurious Copy) /
policy.to_string() (through Display) detour whose type bounds
have no compile-time link to the substrate primitive.
Deliberately routes through the human-readable
RestartPolicy::as_str axis — for this enum the wire format
(PascalCase, tatara-lisp author surface :restart Permanent) and
the diagnostic byte-string share the same vocabulary by
construction (unlike the sibling crate::CaixaKind enum whose
two axes diverge), so the borrowed-input owned-String
projection lands byte-identically on both the wire vocabulary the
paired serde::Serialize derive emits and the diagnostic
vocabulary the RestartPolicy::as_str helper returns, and —
because the paired TryFrom<&str> / RestartPolicy::from_wire
reverse-projection axis parses the same PascalCase vocabulary —
the direct two-way &Self → String → Self round-trip composes
without the wire-vocab intermediate hop the peer
crate::CaixaKind axis pair requires.
The remaining thirteen closed-set typed enums on the caixa
substrate surface (CaixaKind, CaixaDialeto, DepList,
PlacementStrategy, WitShape, RateLimitUnit,
PathShapeViolation, InvariantKind, ArchVerdict, Severity,
FixSafety, Semantic, FerriteRuntime) are the future targets
of this 2×2-completion campaign — each carries the same paired
quintuple that this borrowed-input owned-String axis extends
onto.
Pinned load-bearing by
[tests::restart_policy_from_into_borrowed_owned_string_routes_through_as_str_accessor]
(byte-parity pin against RestartPolicy::as_str across the
three-arm emit-set through the borrowed-input surface) and
[tests::restart_policy_from_into_borrowed_owned_string_agrees_with_paired_axes_on_every_arm]
(cross-axis partition pin against the paired owned-input owned-
String [From<RestartPolicy> for String] impl, the paired
borrowed-input owned-[&'static str] [From<&RestartPolicy> for &'static str] impl, and the sibling ToString::to_string
surface routed through std::fmt::Display, plus a direct round-
trip witness through TryFrom<&str> on the owned-String’s
String::as_str borrow that closes the two-way
&Self → String → Self round-trip on the trait-idiomatic
borrowed-input owned-String forward + reverse axis pair).
Source§fn from(policy: &RestartPolicy) -> String
fn from(policy: &RestartPolicy) -> String
Source§impl From<RestartPolicy> for &'static str
Trait-idiomatic forward projection on the M2-OTP-shape per-child
restart-policy RestartPolicy closed-set typed enum — routes
byte-for-byte through the paired substrate-primitive
RestartPolicy::as_str pub const fn accessor. Return type is
&'static str by construction — every RestartPolicy::as_str arm
resolves to a [crate::render::SUPERVISOR_CHILD_RESTART_*] pub const &str with 'static lifetime, so the trait’s return-type promise is
upheld structurally without a String::leak cast or a per-arm inline
literal.
impl From<RestartPolicy> for &'static str
Trait-idiomatic forward projection on the M2-OTP-shape per-child
restart-policy RestartPolicy closed-set typed enum — routes
byte-for-byte through the paired substrate-primitive
RestartPolicy::as_str pub const fn accessor. Return type is
&'static str by construction — every RestartPolicy::as_str arm
resolves to a [crate::render::SUPERVISOR_CHILD_RESTART_*] pub const &str with 'static lifetime, so the trait’s return-type promise is
upheld structurally without a String::leak cast or a per-arm inline
literal.
Every future consumer that specifically needs &'static str lifetime
bytes on the per-child restart-decision axis (a
[tracing::field::valuable::Value::Str] recording where the Str
arm’s typing demands &'static str, a
std::borrow::Cow::Borrowed::<'static, str>(policy.into()) composer
on the future M4 admission-webhook rejection body where the
Cow<'static, str> typing rules out the sibling AsRef<str>
borrowed return, a generic <T: Into<&'static str>>-bound serializer
or error formatter that requires the 'static bound) reaches the same
lifted crate::render::SUPERVISOR_CHILD_RESTART_PERMANENT /
crate::render::SUPERVISOR_CHILD_RESTART_TEMPORARY /
crate::render::SUPERVISOR_CHILD_RESTART_TRANSIENT substrate-
primitive dispatch rather than an open-coded per-arm literal cascade
whose arm-set has no compile-time link back to the substrate primitive.
Peer of the sibling M2-OTP-shape RestartStrategy forward-projection
impl (523157d) on the per-supervisor sibling-restart-strategy axis —
the second (and second-of-two-in-M2) closed-set typed enum on the
caixa surface to converge onto the paired trait-idiomatic forward-
projection axis. With this lift the paired per-child
:children :restart closed-set typed enum carries the full sibling
quintet (std::fmt::Display, AsRef<str>, [Self::as_str],
TryFrom<&str> via 6fdd0d9, From<Self> for &'static str via this
lift) plus the round-trip witness through both the trait-idiomatic
(From<Self> for &'static str + TryFrom<&str>) and the method-named
(as_str + from_wire) axis pairs — mirrors the sibling
RestartStrategy surface arm-for-arm, so every future arm addition
(an OTP-intrinsic fourth arm the theory
ABSORPTION-ROADMAP
might reach for once the three canonical OTP restart policies stop
covering the substrate’s discovered load-shape) grows the trait-
idiomatic forward axis by construction: one caixa-core edit on
RestartPolicy::as_str extends every one of the five sibling
forward-projection paths (std::fmt::Display, AsRef<str>,
[Self::as_str] itself, this From<Self> for &'static str, and the
un-renamed serde::Serialize derive that also emits as_str’s
bytes) without a coordinated rewrite across every future
Into<&'static str>-bound consumer’s arm-set.
Pinned load-bearing by
[tests::restart_policy_from_into_static_str_routes_through_as_str_accessor]
(byte-parity pin against RestartPolicy::as_str across the
three-arm emit-set, plus a const-context materialization witness for
the &'static str lifetime promise) and
[tests::restart_policy_from_into_static_str_and_as_str_partition_the_emit_set]
(partition pin asserting <&'static str as From<RestartPolicy>>::from
and RestartPolicy::as_str agree on every arm, plus a two-way
round-trip witness through the paired trait-idiomatic reverse-
projection axis TryFrom<&str> (6fdd0d9): every
policy.into::<&'static str>() output re-parses back through
RestartPolicy::try_from to the original variant, closing the two-
way Self ↔ &'static str round-trip on the trait-idiomatic axis pair).
Source§fn from(policy: RestartPolicy) -> &'static str
fn from(policy: RestartPolicy) -> &'static str
Source§impl From<RestartPolicy> for String
Trait-idiomatic owned-String forward projection on the second
M2 OTP-shape closed-set typed enum (RestartPolicy) — the
owned-heap-string companion to the paired &'static str-returning
[From<RestartPolicy> for &'static str] / [From<&RestartPolicy> for &'static str] impls immediately above. Routes byte-for-byte
through the substrate-primitive RestartPolicy::as_str pub const fn accessor (via str::to_owned) so every consumer that
binds a RestartPolicy through the standard-library .into() /
[From<Self> for String] (equivalently Into<String>) axis — a
future serde_json::Value::String(policy.into()) structured-payload
composer where the Value::String arm typing demands an owned
String and the sibling [&'static str]-returning axis forces
an explicit .to_owned() / String::from restatement at every
call site, a future HashMap::<String, RestartPolicy>::from_iter( RestartPolicy::ALL.iter().map(|p| (p.into(), *p))) per-policy
lookup where the map’s key type is owned String rather than
[&'static str], a future Cow::<'static, str>::Owned(policy.into())
composer on the future M4 admission-webhook rejection body’s
owned-arm, the future wasm-operator’s per-child post-exit
diagnostic emit serde_json::json!({ "restart": policy }) where the
JSON serializer’s Serialize impl on String owns the emit-path
— reaches the same three-arm lifted
crate::render::SUPERVISOR_CHILD_RESTART_PERMANENT /
crate::render::SUPERVISOR_CHILD_RESTART_TEMPORARY /
crate::render::SUPERVISOR_CHILD_RESTART_TRANSIENT const the
paired std::fmt::Display, AsRef<str>,
RestartPolicy::as_str, and the two &'static str-returning
forward-projection impls already return.
impl From<RestartPolicy> for String
Trait-idiomatic owned-String forward projection on the second
M2 OTP-shape closed-set typed enum (RestartPolicy) — the
owned-heap-string companion to the paired &'static str-returning
[From<RestartPolicy> for &'static str] / [From<&RestartPolicy> for &'static str] impls immediately above. Routes byte-for-byte
through the substrate-primitive RestartPolicy::as_str pub const fn accessor (via str::to_owned) so every consumer that
binds a RestartPolicy through the standard-library .into() /
[From<Self> for String] (equivalently Into<String>) axis — a
future serde_json::Value::String(policy.into()) structured-payload
composer where the Value::String arm typing demands an owned
String and the sibling [&'static str]-returning axis forces
an explicit .to_owned() / String::from restatement at every
call site, a future HashMap::<String, RestartPolicy>::from_iter( RestartPolicy::ALL.iter().map(|p| (p.into(), *p))) per-policy
lookup where the map’s key type is owned String rather than
[&'static str], a future Cow::<'static, str>::Owned(policy.into())
composer on the future M4 admission-webhook rejection body’s
owned-arm, the future wasm-operator’s per-child post-exit
diagnostic emit serde_json::json!({ "restart": policy }) where the
JSON serializer’s Serialize impl on String owns the emit-path
— reaches the same three-arm lifted
crate::render::SUPERVISOR_CHILD_RESTART_PERMANENT /
crate::render::SUPERVISOR_CHILD_RESTART_TEMPORARY /
crate::render::SUPERVISOR_CHILD_RESTART_TRANSIENT const the
paired std::fmt::Display, AsRef<str>,
RestartPolicy::as_str, and the two &'static str-returning
forward-projection impls already return.
Extends the trait-idiomatic owned-String forward-projection
axis onto the second-of-two M2 OTP-shape closed-set typed enums on
the caixa surface — mirror of the first-mover
[From<RestartStrategy> for String] (7baa18a) that opened this
axis on the sibling supervisor-level strategy enum. Rust’s standard
library does not carry a blanket impl<T: AsRef<str>> From<T> for String (nor an impl<T: fmt::Display> From<T> for String), so
every closed-set typed enum that carries the paired AsRef<str> /
Display / From<Self> for &'static str triple but not the
owned-String axis forces every owned-string call site through a
.to_string() / .as_str().to_owned() / String::from(policy.as_str())
detour whose type bounds have no compile-time link to the
substrate primitive.
Deliberately routes through the human-readable
RestartPolicy::as_str axis — for this enum the wire format
(PascalCase, tatara-lisp author surface :restart Permanent) and
the diagnostic byte-string share the same vocabulary by
construction (unlike the sibling crate::CaixaKind enum whose
two axes diverge), so the owned-String projection lands
byte-identically on both the wire vocabulary the paired
serde::Serialize derive emits and the diagnostic vocabulary the
RestartPolicy::as_str helper returns, and — because the paired
TryFrom<&str> / RestartPolicy::from_wire reverse-projection
axis parses the same PascalCase vocabulary — the direct two-way
Self → String → Self round-trip composes without the wire-vocab
intermediate hop the peer crate::CaixaKind owned-String
axis pair requires.
Pinned load-bearing by
[tests::restart_policy_from_into_owned_string_routes_through_as_str_accessor]
(byte-parity pin against RestartPolicy::as_str across the
three-arm emit-set, plus a blanket .into::<String>() shape
witness) and
[tests::restart_policy_from_into_owned_string_and_static_str_agree_on_every_arm]
(cross-axis partition pin against the paired owned-input
[From<RestartPolicy> for &'static str] impl and the sibling
ToString::to_string surface routed through std::fmt::Display,
plus a .iter().copied().map(String::from) pipe witness over
RestartPolicy::ALL, plus a direct round-trip witness through
TryFrom<&str> on the owned-String’s String::as_str
borrow that closes the two-way Self → String → Self round-trip
on the trait-idiomatic owned-String forward + reverse axis
pair).
Source§fn from(policy: RestartPolicy) -> String
fn from(policy: RestartPolicy) -> String
Source§impl FromStr for RestartPolicy
impl FromStr for RestartPolicy
Source§impl Hash for RestartPolicy
impl Hash for RestartPolicy
Source§impl PartialEq for RestartPolicy
impl PartialEq for RestartPolicy
Source§impl Serialize for RestartPolicy
impl Serialize for RestartPolicy
impl StructuralPartialEq for RestartPolicy
Source§impl TryFrom<&str> for RestartPolicy
Trait-idiomatic reverse projection on the M2-OTP-shape per-child
restart-policy RestartPolicy closed-set typed enum — routes
byte-for-byte through the paired substrate-primitive
RestartPolicy::from_wire Option<Self> accessor so every future
consumer that binds a PascalCase :children :restart wire
byte-string through the standard-library .try_into() / TryFrom
axis (a future [caixa-feira] feira supervisor --restart <Permanent|Temporary|Transient> CLI arg-parse that composes into
let restart: RestartPolicy = s.try_into()?, a future
mesh.pleme.io/v1alpha1/Supervisor CR admission-webhook that folds a
spec.children[*].restart: String field through
RestartPolicy::try_from(&s)?, a generic
<T: TryFrom<&str>>-bound loader over any of the substrate’s closed-
set typed enums) reaches the same three-arm accept-set the sibling
RestartPolicy::from_wire resolver parses through and the sibling
RestartPolicy::as_str emits, rather than an open-coded per-arm
match s { "Permanent" => …, "Temporary" => …, "Transient" => …, _ => … } cascade whose arm-set has no compile-time link back to the
substrate primitive.
impl TryFrom<&str> for RestartPolicy
Trait-idiomatic reverse projection on the M2-OTP-shape per-child
restart-policy RestartPolicy closed-set typed enum — routes
byte-for-byte through the paired substrate-primitive
RestartPolicy::from_wire Option<Self> accessor so every future
consumer that binds a PascalCase :children :restart wire
byte-string through the standard-library .try_into() / TryFrom
axis (a future [caixa-feira] feira supervisor --restart <Permanent|Temporary|Transient> CLI arg-parse that composes into
let restart: RestartPolicy = s.try_into()?, a future
mesh.pleme.io/v1alpha1/Supervisor CR admission-webhook that folds a
spec.children[*].restart: String field through
RestartPolicy::try_from(&s)?, a generic
<T: TryFrom<&str>>-bound loader over any of the substrate’s closed-
set typed enums) reaches the same three-arm accept-set the sibling
RestartPolicy::from_wire resolver parses through and the sibling
RestartPolicy::as_str emits, rather than an open-coded per-arm
match s { "Permanent" => …, "Temporary" => …, "Transient" => …, _ => … } cascade whose arm-set has no compile-time link back to the
substrate primitive.
Complements the pre-existing forward-projection triple
(std::fmt::Display, AsRef<str>, RestartPolicy::as_str)
with the paired trait-idiomatic reverse-projection axis: Rust-side
newtype/typed-enum convention pairs AsRef<str> with either
std::str::FromStr or TryFrom<&str> on the same primitive so a
caller who can project out to a &str can also project in from
one. The TryFrom<&str> axis is deliberately chosen over
std::str::FromStr to sidestep the clippy::should_implement_trait
lint the sibling method-named RestartPolicy::from_wire would
trigger under a FromStr impl and to avoid colliding with the
std::str::FromStr impl the gen_platform::FromStrKind derive
already installs on the paired kebab-case dispatcher-catalog axis
(which parses "permanent" / "temporary" / "transient", the
inverse of Self::discriminant) — this impl closes the trait-
idiomatic reverse axis on the PascalCase wire half without
disturbing either the method-named from_wire shape every sibling
closed-set typed enum on the substrate already carries or the
pre-existing FromStr on the dispatcher-catalog half, keeping the
two-axis split the sibling Self::from_wire doc block motivates.
type Error = () matches the sibling RestartPolicy::from_wire’s
Option<Self> return-shape’s deliberate deferral of error typing: the
caller picks the diagnostic form appropriate for its use site (a
future feira supervisor --restart arg-parse composes its own
per-verb “unknown restart: RestartPolicy::ALL, a future M4 admission-webhook rejection body
wraps the Err(()) outcome with the accepted-set enumeration for
operator diagnostics, a Result::map_err at the call site lifts the
unit-error to a per-verb error type). Same shape the peer
RestartStrategy (5b828ed) on the sibling per-supervisor axis,
crate::CaixaKind (3c83606), crate::CaixaDialeto (bf33136), and
crate::aplicacao::PlacementStrategy (6fd00cd) blocks motivate on
their peer closed-set typed enums’ reverse projections.
The paired TryFrom<&str> impl reaches the same three-arm accept-
set the RestartPolicy::from_wire resolver dispatches through, so
any future arm addition (an OTP-intrinsic fourth arm the theory
ABSORPTION-ROADMAP
might reach for once the three canonical OTP restart policies stop
covering the substrate’s discovered load-shape) grows the trait-
idiomatic axis by construction — one caixa-core edit on
RestartPolicy::from_wire extends both the method-named reverse
projection every existing consumer keys off and the trait-idiomatic
reverse projection this impl exposes, without a coordinated rewrite
across every future TryFrom<&str>-bound consumer’s arm-set.
Extends the substrate-wide closed-set-enum reverse-projection family
(crate::CaixaKind via 3c83606, crate::CaixaDialeto via
bf33136, crate::aplicacao::PlacementStrategy via 6fd00cd, and
RestartStrategy via 5b828ed) onto the third and final OTP-shape
closed-enum discriminator axis on the caixa surface — the paired
per-child :children :restart closed set the future wasm-operator’s
hierarchical reconciliation scheduler’s per-child post-exit
restart-decision branch keys off end-to-end.
Pinned load-bearing by
[tests::restart_policy_try_from_str_routes_through_from_wire_accessor]
(byte-parity pin against RestartPolicy::from_wire across the
three-arm accept-set),
[tests::restart_policy_try_from_str_rejects_unknown_byte_strings]
(rejection witness against silent accept-set widening), and
[tests::restart_policy_try_from_str_and_from_wire_partition_the_accept_set]
(cross-axis partition pin locking the trait and method-named
projections onto one accept-set).
Source§impl TypedDispatcher for RestartPolicy
impl TypedDispatcher for RestartPolicy
Source§fn variant_kinds() -> Vec<&'static str>
fn variant_kinds() -> Vec<&'static str>
Source§fn variant_fields() -> Vec<(&'static str, Vec<&'static str>)>
fn variant_fields() -> Vec<(&'static str, Vec<&'static str>)>
inherit (variant) <fields> Nix patterns.Source§fn variant_count() -> usize
fn variant_count() -> usize
Auto Trait Implementations§
impl Freeze for RestartPolicy
impl RefUnwindSafe for RestartPolicy
impl Send for RestartPolicy
impl Sync for RestartPolicy
impl Unpin for RestartPolicy
impl UnsafeUnpin for RestartPolicy
impl UnwindSafe for RestartPolicy
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,
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.