pub enum WitTarget<'a> {
Http {
endpoint: &'a str,
},
PubSub {
subject: &'a str,
},
Store {
slot: &'a str,
},
Capability,
}Expand description
Typed view of a WitContract’s payload target. Each variant
carries the field its WIT shape requires; constructing a Http
view without an endpoint is impossible by the type system.
Renderers (caixa-mesh L7 rules, feira app graph) match on this
instead of probing Option<String> fields one by one — the
“which payload field is set?” question is answered once, at
validation time.
Variants§
Http
HTTP-shaped WIT world. Carries the configured request path.
PubSub
Pub-sub-shaped WIT world. Carries the event-stream subject.
The IsVariant derive would auto-name the predicate is_pub_sub
(discriminant_to_snake("PubSub") == "pub_sub"); the explicit
#[is_variant(name = "pubsub")] override keeps the emitted
method name byte-identical to the sibling
WitContract::is_pubsub predicate (the paired shape-side
arm-discriminator that routes through
wit_shape_is_pubsub on the wit-world-ref scalar rather than
through matches! on the variant), so the two arm-discriminator
axes — target-side variant-arm and shape-side ref-prefix — reach
every downstream consumer through the same is_pubsub() name.
Store
Key-value-shaped WIT world. Carries the slot template.
Capability
A typed capability edge with no payload selector — the WIT world stands on its own (rare; reserved for plain capability imports or M4-and-later WIT worlds we haven’t shaped yet).
Implementations§
Source§impl<'a> WitTarget<'a>
impl<'a> WitTarget<'a>
Sourcepub const HTTP_FIELD_NAME: &'static str = "endpoint"
pub const HTTP_FIELD_NAME: &'static str = "endpoint"
Canonical author-facing :contratos payload field name for the
HTTP-shaped arm — the expected: &'static str scalar the
AplicacaoError::ContratoMissingTarget /
AplicacaoError::ContratoWrongTarget diagnostic threads
through, the :endpoint "…" keyword the WitTarget::label
duplicate-edge diagnostic emits, and the endpoint=… prefix
the feira app graph verb prints. Peer of
WitTarget::PUBSUB_FIELD_NAME / WitTarget::STORE_FIELD_NAME
on the payload-field-name axis; declared as a peer const next
to the WitTarget::Http variant so a future rename on the
author-surface (defcaixa … :contratos ((:de … :para … :wit … :endpoint …))) field lands in exactly one place, not scattered
across the WitContract::target gate’s six expected:
literals, the label template, and every downstream consumer
that prints a per-arm prefix. Same trajectory as the peer
WitTarget::label lift (174e96a): a single source of truth
for the arm’s shape, next to the variant declaration.
Sourcepub const PUBSUB_FIELD_NAME: &'static str = "subject"
pub const PUBSUB_FIELD_NAME: &'static str = "subject"
Canonical author-facing :contratos payload field name for the
pub-sub-shaped arm. Peer of WitTarget::HTTP_FIELD_NAME /
WitTarget::STORE_FIELD_NAME on the payload-field-name axis;
see WitTarget::HTTP_FIELD_NAME for the full lift rationale.
Sourcepub const STORE_FIELD_NAME: &'static str = "slot"
pub const STORE_FIELD_NAME: &'static str = "slot"
Canonical author-facing :contratos payload field name for the
key/value-store-shaped arm. Peer of
WitTarget::HTTP_FIELD_NAME / WitTarget::PUBSUB_FIELD_NAME
on the payload-field-name axis; see
WitTarget::HTTP_FIELD_NAME for the full lift rationale.
Sourcepub const CAPABILITY_LABEL: &'static str = "(capability — no payload)"
pub const CAPABILITY_LABEL: &'static str = "(capability — no payload)"
Canonical stable human-readable label the payload-less
WitTarget::Capability arm renders as under Self::label —
the byte-string every consumer that formats a payload-less
typed capability edge as text lands on (the
AplicacaoSpec::validate duplicate-:contratos diagnostic
naming which identical edge was declared twice, the future
feira app graph verb’s per-arm prefix, the future M4 per-edge
policy resolver’s audit view, the operator’s mesh-graph audit).
Peer of the payload-arm Self::HTTP_FIELD_NAME /
Self::PUBSUB_FIELD_NAME / Self::STORE_FIELD_NAME
author-facing label-scalar consts — the same
“one canonical declaration per arm, next to the variant, so a
future rename lands in one place” discipline extended to the
payload-less arm. Until this lift landed the byte-string sat
twice — once inline in Self::label’s WitTarget::Capability
match arm, once in the pin test asserting the label’s
WitTarget::Capability output — with no compile-time link
between the two: a rebrand on either side (an operator-facing
vocabulary shift, a per-consumer disambiguation like
"(capability — no payload; typed edge only)") would silently
desynchronize until a downstream consumer surfaced the drift at
runtime.
Sourcepub const CAPABILITY_EXPECTED: &'static str = "none"
pub const CAPABILITY_EXPECTED: &'static str = "none"
Canonical expected: scalar the
AplicacaoError::ContratoWrongTarget diagnostic threads
through for the payload-less WitTarget::Capability arm — the
byte-string authors read as “this WIT world’s shape is not one
of {HTTP, PubSub, Store}, so it must not carry
:endpoint / :subject / :slot”. Peer of the payload-arm
Self::HTTP_FIELD_NAME / Self::PUBSUB_FIELD_NAME /
Self::STORE_FIELD_NAME consts on the
ContratoWrongTarget::expected axis — the fourth arm of the
same “which payload field name goes in the diagnostic” dispatch
the three payload-arm consts cover, extended to the payload-less
arm. Until this lift landed the byte-string sat twice — once
inline in the [Self::target] Capability-arm rejection at the
production dispatch, once in the pin test asserting the
diagnostic’s expected: scalar carries "none" verbatim — with
no compile-time link between the two: a rebrand on either side
(an author-facing vocabulary shift to "capability" /
"(none)" / "no-payload" as the WIT registry’s shape
vocabulary sharpens, a per-consumer disambiguation as M4 splits
WitTarget::Capability into per-shape peers) would silently
desynchronize until a downstream consumer surfaced the drift at
runtime. Same “one canonical declaration per arm, next to the
variant, so a future rename lands in one place” discipline the
peer Self::CAPABILITY_LABEL lift (7ed03a3-era) already
established for the payload-less arm’s human-readable label
axis; this lift extends it onto the peer diagnostic-scalar axis
so both halves of the “how does the Capability arm surface at
its two consumer axes (human-readable label, wrong-target
diagnostic)” pipeline route through peer consts declared next
to the variant.
Pairwise-distinctness against the three payload-arm scalars
(Self::HTTP_FIELD_NAME / Self::PUBSUB_FIELD_NAME /
Self::STORE_FIELD_NAME) is pinned by the sibling
wit_target_expected_scalars_are_pairwise_distinct_across_all_four_arms
test — the 4-way closure of the 3-way
wit_target_field_names_are_pairwise_distinct sibling pin onto
the ContratoWrongTarget::expected axis, matching the peer
m3_placement_estrategia_consts_are_pairwise_distinct closed-set
scalar-value distinctness discipline the sibling M3 typed-enum
discriminator axis already carries.
Sourcepub const CAPABILITY_GRAPH_LABEL: &'static str = "(capability-only)"
pub const CAPABILITY_GRAPH_LABEL: &'static str = "(capability-only)"
Canonical feira app graph per-:contratos-edge payload-column
byte-string the payload-less WitTarget::Capability arm renders
as under Self::graph_label — the sibling
WitTarget::CAPABILITY_LABEL scalar on the peer graph-verb
payload-column axis (the graph verb spells payload-less as
(capability-only), distinct from the duplicate-:contratos
diagnostic’s (capability — no payload) on the human-readable
Self::label axis). Peer of Self::CAPABILITY_LABEL /
Self::CAPABILITY_EXPECTED on the payload-less-arm scalar-const
family — extends the “one canonical declaration per arm, next to
the variant, so a future rename lands in one place” discipline
onto the third payload-less-arm consumer axis (feira app graph
payload column, joining the Self::label duplicate-:contratos
diagnostic axis and the [Self::target] wrong-target diagnostic
axis).
Until this lift landed the byte-string sat inline in
[caixa-feira]’s cmd::app::GraphArgs::run per-:contratos payload-
column match at caixa-feira/src/cmd/app.rs:111 as a raw
"(capability-only)".to_string() literal, with no compile-time link
back to the WitTarget::Capability variant declaration nor to
the sibling Self::CAPABILITY_LABEL / Self::CAPABILITY_EXPECTED
peer consts already carrying the “one canonical declaration per
payload-less-arm consumer axis” discipline. A rebrand on either
side (the graph verb’s operator-facing vocabulary tightening from
"(capability-only)" to "capability" / "(capability edge)" as
the WIT registry vocabulary sharpens, an M4 split of
Self::Capability into per-shape peers) would silently
desynchronize the graph-verb byte-string from the paired
per-arm-adjacent const and land two spellings of the same axis in
two spots.
Sourcepub const fn payload_pair(&self) -> Option<(&'static str, &'a str)>
pub const fn payload_pair(&self) -> Option<(&'static str, &'a str)>
The (author-facing field name, payload) pair this typed target
arm carries — Some((HTTP_FIELD_NAME, endpoint)) for
Self::Http, Some((PUBSUB_FIELD_NAME, subject)) for
Self::PubSub, Some((STORE_FIELD_NAME, slot)) for
Self::Store, None for the payload-less
Self::Capability arm.
Lifted as the single 4-arm dispatch that both Self::label
(formats ":{field} {payload:?}" on Some, falls to
Self::CAPABILITY_LABEL on None) and Self::field_name
(returns the first component) route through, so a future
WitTarget variant addition — the M4-and-later per-edge WIT
registry may split Self::Http into Rest / Grpc peers,
or extend Self::Store with a Queue-shaped peer — becomes
exactly one new match-arm here (a compile-time exhaustiveness
error otherwise), not a coordinated three-way rewrite of the
prior Self::label template + Self::field_name dispatch
- every downstream consumer that reaches for the pair.
Until this lift landed the three payload arms sat in
Self::label as three near-identical format!(":{} {…:?}", …)
invocations (one per variant, each hand-quoting the paired
Self::HTTP_FIELD_NAME / Self::PUBSUB_FIELD_NAME /
Self::STORE_FIELD_NAME const) — the canonical
“same shape, written N times” duplication THEORY.md §I.3.5
(“Generation first, composition second, hand-authoring last;
the duplication budget is zero”) promotes to a build-time
concern, with each per-arm site paired to its own const with no
compile-time link between the format template and the arm’s
payload extraction.
Sourcepub const fn field_name(&self) -> Option<&'static str>
pub const fn field_name(&self) -> Option<&'static str>
The canonical author-facing :contratos payload field name
this typed target arm carries (Http → Some("endpoint"),
PubSub → Some("subject"), Store → Some("slot")), or
None for the payload-less Capability arm.
Routes through Self::payload_pair — the single 4-arm
dispatch Self::label also reads — so a future variant
addition is one match-arm edit at Self::payload_pair, not a
per-consumer rewrite. Same “exhaustive-match at one canonical
dispatch, thin projections at each consumer” trajectory the
peer PlacementStrategy::as_str / std::fmt::Display
pair (0a2f653) landed on the sibling M3 typed-enum axis.
Sourcepub const fn payload(&self) -> Option<&'a str>
pub const fn payload(&self) -> Option<&'a str>
The underlying scalar the payload-carrying arm carries — the
per-arm request path (Self::Http :endpoint), event-stream
subject (Self::PubSub :subject), or slot template
(Self::Store :slot), borrowed from the typed slot’s own
&'a str storage — or None on the payload-less
Self::Capability arm.
Thin projection onto the single 4-arm Self::payload_pair
dispatch (self.payload_pair().map(|(_, p)| p) in const fn
form) — peer of Self::field_name (.payload_pair().0) on
the paired sub-selector axis. Both per-half accessors read from
one authoritative match, so a future WitTarget variant
addition (Rest/Grpc split of Self::Http, Queue-shaped
peer of Self::Store) lands at exactly one caixa-core edit
on Self::payload_pair and both per-half projections + every
downstream consumer picks the new arm up by construction — no
coordinated N-way rewrite across the paired accessor dispatches,
the Self::label / Self::graph_label format templates,
and every future WIT-registry-shaped consumer.
Peer of the sibling caixa-flux
GitRefSpec::ref_value projection on the FluxCD source-
controller spec.ref.<field> axis — same “one paired dispatch,
both per-half projections as thin readers, every downstream
consumer through the same match” discipline extended onto the
M3 :contratos payload-arm axis. Closes the discipline-parity
gap between the two paired-dispatch surfaces: the peer
Self::payload_pair + Self::field_name pair carried only
the first-component projection until this lift; the second-
component sibling now sits alongside so both halves reach every
future consumer through the same substrate-primitive dispatch.
Sourcepub const fn http_endpoint(&self) -> Option<&'a str>
pub const fn http_endpoint(&self) -> Option<&'a str>
Substrate-canonical per-arm HTTP-endpoint scalar accessor every
consumer that fans on the L7-HTTP-shaped payload keys off —
returns the Self::Http-arm’s author-declared request path
verbatim as an Option<&'a str>, Some(endpoint) when the
projected target is [Self::Http { endpoint }], None on the
three sibling arms (Self::PubSub / Self::Store /
Self::Capability, each of which carries no HTTP endpoint by
definition).
The Self::Http arm carries the Cilium L7 HTTPNetworkPolicy
path: rule payload every substrate-side L7-introspecting
per-(:de, :para) CiliumNetworkPolicy emitter reads (today: the
[caixa_mesh::cilium_network_policies] per-edge toPorts[].rules .http[0].path scalar the HTTP-shape-only L7 rule builder emits
on the L7 introspection branch; every peer WIT shape stays
L4-only because Cilium can’t introspect NATS / key-value / plain
capability edges), and every future L7-introspecting consumer
of the projected target’s HTTP endpoint (the future M4
per-(:de, :para) mesh.pleme.io/v1alpha1/Aplicacao CR
materializer’s per-edge L7 admission-webhook overlay, the
future Envoy-side local_rate_limit.descriptor_entries per-HTTP-
path bucket-key resolver, the future per-:contratos-edge
mTLS-required overlay’s HTTP-shape scope filter, the future
feira app graph --l7 per-Aplicacao HTTP-path column) reaches
through the same typed dispatch.
Prior to this lift the sole production consumer of the projected-
target HTTP endpoint — the [caixa_mesh::cilium_network_policies]
per-edge L7 introspection branch at caixa-mesh/src/lib.rs:2759
(if let WitTarget::Http { endpoint } = c.target().expect(…) { http_rule.insert_string(CILIUM_KEY_PATH, endpoint.to_string()); … }) — reached the payload through a raw per-arm if let pattern-
match that expressed no compile-time link back to the substrate
primitive’s typed dispatch, sibling to the WitContract pre-
projection WitContract::endpoint (7020470) Option<&str>
scalar accessor on the peer per-:contratos raw-field axis but
with no post-projection peer on the typed-view surface. A future
WitTarget variant addition that splits Self::Http into
peers (a Rest/Grpc split once the WIT registry stabilizes
gRPC-shaped worlds per this enum’s own docstring at
aplicacao.rs:1341-1343 — with a Rest-arm endpoint: &'a str
payload alongside a Grpc-arm service_method: &'a str payload)
would have had to be threaded through the caixa-mesh L7 emit
branch’s raw if let in lockstep — either coalescing the two
L7-HTTP-family arms under a shared path: emit, or splitting the
emit path per-arm — with no substrate-primitive dispatch making
the “which arms count as L7-HTTP-shaped for path-emission
purposes” question the substrate’s answer to give. Lifting the
resolution to a typed method on the substrate primitive means
every downstream L7-HTTP-facing consumer of the Aplicacao’s
projected-target HTTP endpoint reaches for exactly one typed
dispatch — the resolver’s accept-set migrates as a unit on any
future arm-family widening, and the caixa-mesh L7 emit branch
reads through the same substrate primitive.
Peer of the sibling pre-projection WitContract::endpoint
(7020470) Option<&str> scalar accessor on the raw
:contratos :endpoint field-access axis — same “one typed
dispatch on the substrate primitive, thin projections at each
consumer” discipline extended onto the peer post-projection typed-
view surface (the WitContract::endpoint pre-projection
accessor returns Some for any author-declared :endpoint
value regardless of the paired :wit world’s HTTP-shape
classification — the raw slot before validation crosses it —
while this post-projection Self::http_endpoint accessor
returns Some iff the target has been projected onto the
Self::Http arm, i.e. only after the WitContract::target
gate has admitted the (:wit, :endpoint/:subject/:slot) shape
coherence; the two accessors close the pre-projection /
post-projection pair on the HTTP-endpoint axis). Sibling of the
unified pan-arm Self::payload (Option<&'a str> for any of
the three payload-carrying arms) — extends the per-arm
projection family onto the Self::Http specialization axis
that the pan-arm accessor’s shape blends into a single arm-
agnostic view; paired with Self::pubsub_subject /
Self::store_slot on the sibling per-arm axes so every
per-payload-arm shape carries a named post-projection accessor
on the same shape as http_endpoint, closing the per-arm-shape
accept-set the substrate primitive owns.
Sourcepub const fn pubsub_subject(&self) -> Option<&'a str>
pub const fn pubsub_subject(&self) -> Option<&'a str>
Substrate-canonical per-arm pub-sub-subject scalar accessor every
consumer that fans on the pub-sub-shaped payload keys off —
returns the Self::PubSub-arm’s author-declared event-stream
subject verbatim as an Option<&'a str>, Some(subject) when
the projected target is [Self::PubSub { subject }], None on
the three sibling arms (Self::Http / Self::Store /
Self::Capability, each of which carries no NATS-shaped
subject by definition).
The Self::PubSub arm carries the NATS-server-accepted subject
the future substrate-side pub-sub-introspecting per-(:de, :para)
consumer keys off (the M4 per-Aplicacao NATS Stream / Consumer
CR materializer’s spec.subjects[] projection, the future
Envoy-side per-subject local_rate_limit.descriptor_entries
bucket-key resolver, the future feira app graph --pubsub
per-Aplicacao subject column, any future substrate-lifted
pub-sub-shape emitter that reads a projected WitTarget in the
same shape [caixa_mesh::cilium_network_policies] reads the
HTTP-shape one at caixa-mesh/src/lib.rs:2780 today). Every
future pub-sub-shape consumer reaches for the same typed
dispatch this accessor exposes so the “which arm carries the
subject scalar?” answer lives at one caixa-core edit rather
than open-coded across per-consumer if let WitTarget::PubSub { subject } = c.target()… pattern-matches.
Peer of the sibling Self::http_endpoint (5d6dc92 trajectory)
per-arm HTTP-endpoint accessor on the peer per-arm axis and of
the pre-projection WitContract::subject scalar accessor on
the raw :contratos :subject field-access axis — same “one
typed dispatch on the substrate primitive, thin projections at
each consumer” discipline extended onto the per-arm pub-sub
post-projection axis. The pre-projection accessor returns
Some for any author-declared :subject value regardless of
the paired :wit world’s pub-sub-shape classification (the raw
slot before validation crosses it); this post-projection
accessor returns Some iff the target has been projected onto
the Self::PubSub arm, i.e. only after the
WitContract::target gate has admitted the
(:wit, :endpoint/:subject/:slot) shape coherence — closing
the pre-/post-projection pair on the pub-sub-subject axis to
match the pair the WitContract::endpoint +
Self::http_endpoint surfaces already close on the peer
HTTP-endpoint axis.
Sibling of the unified pan-arm Self::payload
(Option<&'a str> for any of the three payload-carrying arms) —
extends the per-arm projection family onto the Self::PubSub
specialization axis that the pan-arm accessor’s shape blends
into a single arm-agnostic view; the pair
(pubsub_subject, store_slot) closes the trio
(http_endpoint, pubsub_subject, store_slot) so every
payload arm now carries its own per-arm-shape post-projection
accessor.
Sourcepub const fn store_slot(&self) -> Option<&'a str>
pub const fn store_slot(&self) -> Option<&'a str>
Substrate-canonical per-arm key/value-store-slot scalar accessor
every consumer that fans on the store-shaped payload keys off —
returns the Self::Store-arm’s author-declared slot template
verbatim as an Option<&'a str>, Some(slot) when the
projected target is [Self::Store { slot }], None on the
three sibling arms (Self::Http / Self::PubSub /
Self::Capability, each of which carries no
key/value-store slot by definition).
The Self::Store arm carries the WASI-key/value-accepted slot
template (validated by crate::render::is_wasi_keyvalue_slot)
every future substrate-side store-introspecting per-(:de, :para) consumer keys off (the M4 per-Aplicacao WASI-key/value
namespace / prefix reconciler’s per-slot projection, the future
per-store-backend routing overlay’s slot-shape gate, the future
feira app graph --store per-Aplicacao slot column, any future
substrate-lifted store-shape emitter that reads a projected
WitTarget in the same shape [caixa_mesh::cilium_network_policies]
reads the HTTP-shape one at caixa-mesh/src/lib.rs:2780 today).
Every future store-shape consumer reaches for the same typed
dispatch this accessor exposes so the “which arm carries the
slot scalar?” answer lives at one caixa-core edit rather than
open-coded across per-consumer
if let WitTarget::Store { slot } = c.target()…
pattern-matches.
Peer of the sibling Self::http_endpoint +
Self::pubsub_subject per-arm accessors on the peer per-arm
axes and of the pre-projection WitContract::slot scalar
accessor on the raw :contratos :slot field-access axis — same
“one typed dispatch on the substrate primitive, thin projections
at each consumer” discipline extended onto the per-arm store
post-projection axis. Closes the pre-/post-projection pair on
the store-slot axis to match the pairs the
WitContract::endpoint + Self::http_endpoint and
WitContract::subject + Self::pubsub_subject surfaces
already close on the peer HTTP-endpoint and pub-sub-subject
axes; the substrate-side pre-/post-projection accessor family
now spans all three payload arms as a matched trio, so any
future arm-shape widening (a Rest/Grpc split of
Self::Http, a Queue-shaped peer of Self::Store) that
lands one accessor without threading through the sibling
pre-projection or the peer per-arm post-projection surfaces a
compile-time exhaustiveness error at the substrate primitive,
not a silent per-consumer split at renderer emit time.
Sibling of the unified pan-arm Self::payload
(Option<&'a str> for any of the three payload-carrying arms) —
closes the per-arm projection family onto the Self::Store
specialization axis that the pan-arm accessor’s shape blends
into a single arm-agnostic view. The trio
(http_endpoint, pubsub_subject, store_slot) partitions the
pan-arm accept-set on every payload-carrying arm: exactly one
per-arm accessor returns Some(payload) and the two peers
return None, and every payload-less Self::Capability
input returns None on all three — the partition the sibling
wit_target_per_arm_post_projection_accessors_partition_the_payload_arm_set
pin locks in load-bearing.
Sourcepub fn label(&self) -> String
pub fn label(&self) -> String
Render this typed target as a stable human-readable label
(:endpoint "/charge", :subject "events.x",
:slot "checkout/$order", or (capability — no payload) when
the WIT world is a pure capability edge).
Used by the AplicacaoSpec::validate duplicate-:contratos
gate so the diagnostic names which identical edge was
declared twice (not just which (de, para, wit) triple).
Routes through the single 4-arm Self::payload_pair dispatch
on the payload-carrying arms (Some((field, payload)) → format!(":{field} {payload:?}")) and through the lifted
Self::CAPABILITY_LABEL const on the payload-less
Self::Capability arm — so a future variant addition (the
M4-and-later per-edge WIT registry may split Self::Http
into Rest / Grpc, or extend Self::Store with a
Queue-shaped peer) becomes a single new match-arm on
Self::payload_pair rather than a rewrite of this template
(and every downstream consumer that reaches for the label
shape: the per-edge policy resolver in M4, the feira app graph view, the operator’s mesh-graph audit). Until this
lift landed the three payload arms carried three near-identical
per-arm format!(":{} {…:?}", …) invocations, and the
Self::Capability arm carried the payload-less byte-string
twice (once inline here, once in the pin test) — closing the
duplication trajectory the peer Self::HTTP_FIELD_NAME /
Self::PUBSUB_FIELD_NAME / Self::STORE_FIELD_NAME (174e96a
/ 4a1e490) peer-const lifts already established for the
payload-carrying arms.
Sourcepub fn graph_label(&self) -> String
pub fn graph_label(&self) -> String
Render this typed target as the feira app graph per-:contratos
payload-column byte-string (endpoint=/charge, subject=events.x,
slot=checkout/$order, or Self::CAPABILITY_GRAPH_LABEL on the
payload-less arm).
Routes through the single 4-arm Self::payload_pair dispatch
on the payload-carrying arms (Some((field, payload)) → format!("{field}={payload}")) and through the lifted
Self::CAPABILITY_GRAPH_LABEL const on the payload-less
Self::Capability arm — so a future variant addition
(the M4-and-later per-edge WIT registry may split Self::Http
into Rest / Grpc, or extend Self::Store with a
Queue-shaped peer) becomes one match-arm edit at
Self::payload_pair, propagating through this graph-verb
projection at zero call-site cost, sibling to the peer
Self::label duplicate-:contratos diagnostic emission on the
same 4-arm dispatch.
Until this lift landed the [caixa-feira]
cmd::app::GraphArgs::run per-:contratos payload column
(caixa-feira/src/cmd/app.rs:101-112) hand-rolled the same 4-arm
dispatch inline, re-projecting HTTP_FIELD_NAME /
PUBSUB_FIELD_NAME / STORE_FIELD_NAME under a per-arm
format!("{}={endpoint}", ...) template and hard-coding
"(capability-only)" as a fifth payload-less scalar with no link
back to the paired WitTarget::Capability variant declaration.
A future variant addition would have had to be threaded through
both Self::label (via Self::payload_pair) and the graph
verb’s inline match in lockstep or the two projections would
silently disagree on the arm-set the graph verb prints — the
duplicate-:contratos diagnostic reading one shape while the
graph verb’s payload column silently dropped the new arm to
(capability-only). Lifting the graph-verb projection onto the
same substrate-primitive Self::payload_pair dispatch closes
the axis: both projections migrate as a unit.
The field=payload (no colon prefix, = separator, no Debug
quoting) shape is graph-verb-canonical — distinct from the
sibling Self::label ":{field} {payload:?}" shape the
duplicate-:contratos diagnostic seeds (see
Self::CAPABILITY_LABEL vs. Self::CAPABILITY_GRAPH_LABEL
on the payload-less axis for the paired distinction).
Trait Implementations§
impl<'a> Copy for WitTarget<'a>
Source§impl Display for WitTarget<'_>
std::fmt::Display routed through WitTarget::label, so the
pretty-printed byte-string every consumer that formats a typed
payload target as user-facing text lands on (the
AplicacaoError::ContratoDuplicate diagnostic’s target: carry
the AplicacaoSpec::validate duplicate-:contratos gate seeds via
WitTarget::label at aplicacao.rs:5491, the future feira app graph per-:contratos-edge payload column that reaches the graph
verb through format!("{target}"), the future M4 per-edge policy
resolver’s per-edge audit-log line, the operator’s mesh-graph
per-edge inspection view) reaches for the same lifted
WitTarget::HTTP_FIELD_NAME / WitTarget::PUBSUB_FIELD_NAME /
WitTarget::STORE_FIELD_NAME / WitTarget::CAPABILITY_LABEL
const set the WitTarget::payload_pair 4-arm dispatch already
routes through — extending the three-path-convergence
(Debug for structural inspection, Display for user-facing text,
per-arm typed accessor for the canonical byte-string) discipline the
sibling M3 PlacementStrategy and M2 crate::supervisor::RestartStrategy
/ crate::supervisor::RestartPolicy OTP-shape typed enums carry
onto the fourth (and only remaining) typed-shape-discriminator axis
on the caixa surface.
impl Display for WitTarget<'_>
std::fmt::Display routed through WitTarget::label, so the
pretty-printed byte-string every consumer that formats a typed
payload target as user-facing text lands on (the
AplicacaoError::ContratoDuplicate diagnostic’s target: carry
the AplicacaoSpec::validate duplicate-:contratos gate seeds via
WitTarget::label at aplicacao.rs:5491, the future feira app graph per-:contratos-edge payload column that reaches the graph
verb through format!("{target}"), the future M4 per-edge policy
resolver’s per-edge audit-log line, the operator’s mesh-graph
per-edge inspection view) reaches for the same lifted
WitTarget::HTTP_FIELD_NAME / WitTarget::PUBSUB_FIELD_NAME /
WitTarget::STORE_FIELD_NAME / WitTarget::CAPABILITY_LABEL
const set the WitTarget::payload_pair 4-arm dispatch already
routes through — extending the three-path-convergence
(Debug for structural inspection, Display for user-facing text,
per-arm typed accessor for the canonical byte-string) discipline the
sibling M3 PlacementStrategy and M2 crate::supervisor::RestartStrategy
/ crate::supervisor::RestartPolicy OTP-shape typed enums carry
onto the fourth (and only remaining) typed-shape-discriminator axis
on the caixa surface.
Pre-lift the two paths were structurally independent — every consumer
reaching for a payload byte-string past the WitTarget::label
helper had to pick between three paths (WitTarget::label,
format!("{v:?}") on the Debug derive, hand-rolled per-arm
formatting through the WitTarget::HTTP_FIELD_NAME /
WitTarget::PUBSUB_FIELD_NAME / WitTarget::STORE_FIELD_NAME /
WitTarget::CAPABILITY_LABEL const set), and a future consumer
that reached for format!("{target}") — the canonical shape every
user-facing pretty-print site on the sibling typed-enum axes already
uses — would silently land on the Debug derive’s structural output
(Http { endpoint: "/charge" } — Rust struct-literal syntax) rather
than the label() helper’s stable byte-string (:endpoint "/charge" — the author-facing :contratos keyword form) the
substrate-side duplicate-:contratos gate at aplicacao.rs:5491
already threads through. The two spellings would diverge silently in
every downstream diagnostic / graph / audit line reached through
format! rather than through the label() helper. Routing
std::fmt::Display through WitTarget::label closes the third
path: every format!("{v}") call reaches the same
WitTarget::payload_pair-shaped byte-string the label() helper
and the duplicate-:contratos gate already route through, so a
future variant addition (the M4-and-later per-edge WIT registry may
split WitTarget::Http into Rest / Grpc peers, or extend
WitTarget::Store with a Queue-shaped peer) reaches every
consumer at exactly one place — the WitTarget::payload_pair
match — rather than fanning out through hand-rolled per-arm
std::fmt::Display arms.
The dispatcher-catalog identity remains unaffected — WitTarget
is the typed view returned by WitContract::target, not a
closed-set discriminator enum with a gen-platform Discriminant
registration, so the Debug derive’s structural output (which every
{v:?} consumer still reaches) stays distinct from the Display
helper’s stable pretty-printed byte-string. Debug reveals variant
shape for structural inspection; Display (via label) reveals the
stable author-facing payload projection.
Pin tests
[tests::wit_target_display_routes_through_label_helper] and
[tests::wit_target_display_matches_duplicate_contratos_diagnostic_carrier]
assert the two paths agree byte-for-byte on every variant, so a
future variant addition or label() reimplementation that hand-rolls
the arms instead of delegating to WitTarget::payload_pair is a
build error visible at caixa-core test time, not a silent
per-consumer dispatch miss at diagnostic / audit / graph time.
impl<'a> Eq for WitTarget<'a>
impl<'a> StructuralPartialEq for WitTarget<'a>
Auto Trait Implementations§
impl<'a> Freeze for WitTarget<'a>
impl<'a> RefUnwindSafe for WitTarget<'a>
impl<'a> Send for WitTarget<'a>
impl<'a> Sync for WitTarget<'a>
impl<'a> Unpin for WitTarget<'a>
impl<'a> UnsafeUnpin for WitTarget<'a>
impl<'a> UnwindSafe for WitTarget<'a>
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.