pub trait RoutingSpecOptionExt {
// Required method
fn has_form(&self, kind: RoutingForm) -> bool;
}Expand description
Extension trait collapsing the Option-carrier arm on
Option<RoutingSpec> — the ONE substrate primitive that owns the
“collapse the parent routing Option-carrier before probing the
inner spec’s derived form” discipline the point-domain require-tag
classifier in tatara-reconciler::bin::tatara-check composed by
hand pre-lift at ("routing-form-", RoutingForm, |k| spec.routing .as_ref().is_some_and(|r| r.has_form(k))).
Peer to crate::encapsulates::EncapsulatesSpecOptionExt on the
sibling Option<EncapsulatesSpec> slot of
crate::crd::ProcessSpec — both extension traits live on
Option<<parent-spec>>, both own the .as_ref().is_some_and(|p| p.<probe>(k)) chain at ONE substrate site, and both return
false on the outer None arm (a Process that DECLINED the
respective surface — in-cluster-only for routing, unencapsulated
for encapsulates). Together they close the pattern’s blast radius
across the two Option-parent presence-probe families whose parent
is Option<<inner-spec>> directly on crate::crd::ProcessSpec,
so every current + future presence probe on THOSE parents inherits
the collapse mechanically through the SAME trait-method shape.
Sibling Option-parent collapse whose parent is instead a compound
projection: crate::lifetime::Lifetime::ephemeral_exports —
walks Lifetime → resolved_ephemeral() → exports and returns
&[] on the None arm (as a slice, not a bool) so the six
slice-level ExportSpecSliceExt::* probes compose without a
bespoke Option-arm at the caller. This trait is the direct
analogue for the Option-parent whose inner spec ITSELF carries
the probe (no intermediate slice).
§Semantics — COLLAPSED-NONE vs DELEGATED-SOME
None(an in-cluster-only Process that DECLINED the routing surface entirely) → returnsfalsefor EVERYRoutingFormkind. The absent-carrier arm is NOT the derivedRoutingForm::Instancedefault that a POPULATEDRoutingSpecwithstable_name_claim: false(its serde default) would publish — the derived-scalar default only fires when the operator OPTED INTO the routing surface and left the discriminating slot at its default, not when they declined the surface entirely.Some(r)→ delegates toRoutingSpec::has_formbyte- identically. The populated arm is the ONLY behavioral surface the collapse preserves through the SAMERoutingForm::from_is_stableprojection over thestable_name_claimbool.
§Compounding
A future second presence-probe axis on RoutingSpec (a
hypothetical has_backend_kind on a widened
RoutingBackend closed set, a
has_priority_tier(TierKind) reaching through a typed
projection over the raw priority: i32 slot, a future
discriminator on a widened stable_name_claim typed enum) lands
as ONE more method on this trait + ONE more prefix-table row in
the classifier — no per-caller .as_ref().is_some_and(...)
restatement, no per-caller spec.routing.as_ref() walk. A future
diagnostic shift on the Option-carrier collapse (surfacing
“routing declined” as a distinct near-miss from “routing set but
axis absent”) reaches THIS ONE substrate owner, and every present
or future require-tag family on the SAME
crate::crd::ProcessSpec::routing parent inherits the shift by
construction.
Theory anchor: THEORY.md §II.1 invariant 5 (composition preserves
proofs — the Option-carrier collapse lives at ONE substrate site
so every downstream routing-<axis> require-tag family binds
through the SAME shape). THEORY.md §VI.1 (generation over
composition — a new probe on RoutingSpec reaches this trait
through a peer method without a bespoke Option-arm at the caller).
Pinned by
[tests::routing_spec_option_ext_has_form_returns_false_on_none_for_every_kind]
and
[tests::routing_spec_option_ext_has_form_matches_inner_probe_when_present].
Required Methods§
Sourcefn has_form(&self, kind: RoutingForm) -> bool
fn has_form(&self, kind: RoutingForm) -> bool
True iff this Option<RoutingSpec> is Some(r) AND
RoutingSpec::has_form on the inner spec answers true
for the given RoutingForm. Returns false on None (an
in-cluster-only Process that declined the routing surface
entirely) — INCLUDING for the derived default
RoutingForm::Instance, because the operator DECLINED the
routing surface rather than defaulting into it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".