pub fn kube_field_map<'a, R: KubeReceiver + ?Sized>(
recv: &'a R,
field: &str,
map_field: &str,
) -> Option<&'a Mapping>Expand description
Read a sub-<mid>.<tail> YAML sub-mapping nested two hops under an
arbitrary KubeReceiver as Option<&serde_yaml::Mapping> — the
value-level three-hop navigation primitive that folds .get(<mid>) .and_then(|v| v.get(<tail>)).and_then(|v| v.as_mapping()) into a
single helper call. Exactly kube_field(recv, mid).and_then(|v| kube_map(v, tail)) — the composed peer of the value-level
kube_field (e04c234) one-hop pass-through and the value-level
sub-mapping-arity kube_map (28fa5d8) two-hop accessor. Sub-
mapping-arity sibling of the composed scalar-str kube_field_str
(1c68424), composed scalar-u64 kube_field_u64 (e6fca52),
composed scalar-bool kube_field_bool (261894b), composed
sequence-tail kube_field_seq (a45bd8b), and composed raw-tail
kube_field_field (cb5d862) accessors on the same three-hop
axis: where those five composed accessors fold a trailing
.as_str() / .as_u64() / .as_bool() / .as_sequence() shape-
gate (or pass through the raw &Value tail) onto the two-hop-
nested navigation, this accessor folds the trailing .as_mapping()
shape-gate on the same navigation, so every routed two-hop
.and_then(|X| kube_field(X, <MID>)).and_then(|Y| kube_map(Y, <TAIL>)) middle-hop-plus-sub-mapping-tail block (the canonical
per-K8s-document metadata.labels per-resource-label-block readback
on the KUBE_KEY_METADATA middle-hop + KUBE_KEY_LABELS tail
axis the sibling specialization kube_metadata_labels already
pins from the root, the future per-HTTPRoute per-rule
matches[<i>].path per-match path-selection sub-mapping readback
once the M4 typed per-match overlay lands, the future per-CNP
spec.egress[<i>].authentication per-egress auth sub-mapping
readback under an egress-authentication overlay, the future per-
HelmRelease per-spec.values.<library> per-child-chart sub-
mapping readback once the [&Mapping]-receiver overlay peer lands)
folds onto one dispatch.
Returns None on any of the four short-circuit arms folded through
the underlying three-hop composition: the receiver carries a YAML
type without a get(<mid>) navigation surface
(serde_yaml::Value::get returns None on scalar arms — string,
bool, number, null — that expose no per-key lookup), the requested
<mid> middle-hop axis-key is absent from the receiver’s mapping,
the <mid> sub-field value is present but carries a YAML shape
with no get(<tail>) navigation surface (a scalar arm at the
middle-hop altitude — the inner serde_yaml::Value::get scalar-
arm None folds through), or the <tail> value is present but
carries a non-mapping YAML type (the trailing .as_mapping()
shape-gate short-circuit — a schema-invalid nested type per the
K8s apiserver’s OpenAPI schema but tolerated here as None so
the readback stays a total function, mirroring the sibling
kube_field_str / kube_field_u64 / kube_field_bool /
kube_field_seq posture). The returned &Mapping borrows into
the input receiver — the caller decides whether to .iter() for
a per-key enumeration, .contains_key(<K>) for a presence probe,
.get(<K>) for a downstream .and_then continuation, or
.expect(...) for a load-bearing full-sub-mapping bind.
Closes the composed value-level shape-gated family at the fifth
and final of the shape-gate arities the four sibling shape-gated
composed accessors opened — with this sub-mapping-arity peer the
family now spans str, u64, bool, sequence, and sub-mapping at the
two-hop-nested altitude, matching the closed shape of the spec-
anchored family one altitude above where kube_spec_field plus
the shape-gated kube_spec_str_field / kube_spec_u64_field
/ kube_spec_bool_field / kube_spec_seq_field /
kube_spec_map_field variants already span the axis, and the
closed shape of the value-level primitive family (kube_field,
kube_str, kube_u64, kube_bool, kube_seq,
kube_map) one altitude below where the value-level primitives
already span the K8s apiserver OpenAPI schema shape arities the
two-hop navigation resolves through. The routed producer-side
specialization kube_metadata_labels on the canonical
metadata.labels per-K8s-document axis (already lifted) is the
natural composition-symmetric peer at the M2/M3 metadata altitude
that this generic composed accessor closes at the composed value-
level altitude.
Every future nested <mid>.<tail> sub-mapping readback the M3.x +
M4 renderer set materializes (the future per-:contratos per-edge
WIT-attribute nested sub-mapping once the M4 typed per-edge overlay
lands, the future per-Aplicacao
spec.placement.affinity.podAffinity nested pod-affinity sub-
mapping readback under a placement-shape probe, the future
caixa-otel per-Servico per-processors.<name>.config nested
processor-config sub-mapping probe, every future test-side nested-
sub-mapping readback the M3.x + M4 renderer set adds under
.contains_key(<K>) / .iter() / .get(<K>).and_then(...)
enumeration) reaches this one helper by construction. No per-
consumer two-hop re-inline; no coordinated rewrite across every
nested-sub-mapping readback on a future serde_yaml surface
rebrand or shape-gate shift. Symmetric closure of the composed
value-level shape-gated family the four prior lifts opened.