pub trait SequenceExt {
// Required method
fn push_mapping(&mut self, value: Mapping);
}Expand description
Extension methods for the Vec<serde_yaml::Value> emission
surface that the K8s-artifact-emit sites of caixa-mesh /
caixa-flux / caixa-helm / caixa-core::render build up as
spec.ingress[] / spec.rules[] / spec.hostnames[] / per-
programs.yaml-entry payloads before wrapping each vec as a
serde_yaml::Value::Sequence on an outer serde_yaml::Mapping
(via MappingExt::insert_sequence).
Peer to MappingExt on the sibling serde_yaml::Value-
construction surface: MappingExt closes the per-key-and-value
insert primitive every schema-key axis reaches through;
SequenceExt closes the per-list-element push primitive every
per-iteration append site reaches through when the built-up
serde_yaml::Value variant is uniform across a loop body (e.g.
every element is a fresh serde_yaml::Value::Mapping, not a
heterogeneous mix of Mapping / String / Sequence).
Each method mints the same Value::<Variant>(<payload>) promotion
the caller would otherwise re-inline as
vec.push(serde_yaml::Value::<Variant>(<payload>)) on every
iteration. Same variant-promotion contract as MappingExt’s
typed inserts, applied to the sequence-append axis instead of the
mapping-insert axis — so a future rebrand of the Value variant
wrapping (e.g. to a Server-Side-Apply-typed
serde_yaml::Value::Tagged per-list-element ownership axis)
reaches both Mapping-insert and Vec<Value>-push sites through
one lift.
Required Methods§
Sourcefn push_mapping(&mut self, value: Mapping)
fn push_mapping(&mut self, value: Mapping)
Append Value::Mapping(value) to self — the per-iteration
append shape that combines a Vec<serde_yaml::Value>::push
with an automatic serde_yaml::Value::Mapping promotion of a
pre-built serde_yaml::Mapping element.
The canonical shape 4 production call sites across caixa-mesh
previously carried inline as the three-token block
<vec>.push(serde_yaml::Value::Mapping(<M>)) — a one-token
semantic payload (the per-iteration Mapping) buried under a
two-axis boilerplate (serde_yaml:: path re-quote,
Value::Mapping(_) promotion) around a Mapping variable the
caller already built.
Sites lifted:
- caixa-mesh’s
programs_for_aplicacaoper-:membrosprograms.yaml entry append (per-member entryMapping→ the fan-outVec<Value>); - caixa-mesh’s
cilium_network_policiesper-edgespec.ingress[].toPorts[]L4-and-L7 port-and-rule append (per-(:de, :para)group’s per-edgeto_portMapping → theto_ports_seqVec); - caixa-mesh’s
cilium_network_policiesper-policy top-level CNP-document append (per-(:de, :para)group’s builtpolicyMapping → the render-outputVec<Value>); - caixa-mesh’s
gateway_routesper-HTTPRoute-rulespec.rules[]append (per-path builtruleMapping → therulesVec).
Lifting collapses the three-token block into one method call
the caller reads as intent (<vec>.push_mapping(<M>) —
“append this built inner M as the next Value::Mapping
element”) rather than three hand-spelled positional artifacts
(serde_yaml:: path re-quote, Value::Mapping(_) promotion,
plus the .push(_) call itself). Peer to
MappingExt::insert_singleton_mapping_sequence on the
singleton-Mapping-list-shape axis: Self::push_mapping
builds up a multi-element Vec<Value> per iteration when the
caller then calls MappingExt::insert_sequence to route the
finished vec under a schema key;
MappingExt::insert_singleton_mapping_sequence fuses the
singleton wrap + the schema-key insert into one call when the
caller has exactly one Mapping element to emit under a schema
key.
The next renderer to land — the per-:politicas
CiliumClusterwideEnvoyConfig emitter (whose per-policy
spec.resources[] / spec.listeners[] / spec.virtualHosts[]
list-shape axes fan out multi-Mapping-element per iteration,
MESH-COMPOSITION §III.2 #3), the app-operator’s typed
mesh.pleme.io/v1alpha1/Aplicacao CR materializer (per-
spec.selectors[] / per-spec.gates[] multi-element append,
§III.2 #5), the M4 cross-cluster fan-out’s per-cluster
multi-entry Service.spec.ports[] /
HTTPRoute.spec.rules[].backendRefs[] list append, the future
caixa-otel OpenTelemetry-Collector per-pipeline
receivers[] / processors[] / exporters[] multi-element
append — gets the canonical Value::Mapping-promoted append
for free with one method call, instead of re-inlining the
three-token Value::Mapping(_) promotion.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".