pub struct RenderedFile {
pub path: PathBuf,
pub contents: String,
}Expand description
One rendered artifact — a (path, contents) pair every per-target
caixa-<target> renderer emits at every leaf of its output tree.
Carries the sandboxed relative path the substrate writes the artifact
under (relative to the renderer-chosen output root — the per-chart
directory for caixa-helm’s lareira-<nome> chart tree,
the per-caixa ./clusters/<cluster>/services/<nome>/ sub-tree for
caixa-flux’s cluster_bundle Flux v2 CR trio)
alongside the pre-serialized byte contents the substrate writes to it.
Lifted from two identical-shape per-renderer arms in
caixa-flux (BundleFile { path: PathBuf, contents: String }) and caixa-helm (ChartFile { path: PathBuf, contents: String }) — same field pair, same derives (`Debug + Clone
- PartialEq + Eq
), no per-type impls — carrying the same "one rendered leaf artifact" contract twice. Every prior per-target renderer had reinvented the same two-field record because there was no substrate-side canonical(path, contents)shape to reach for; the future per-target renderers the M4/M5 roadmap acknowledges (caixa-otel's per-collector-config emit, the future per-Aplicacaomesh.pleme.io/v1alpha1/AplicacaoCR materializer's per-CR YAML emit, the future per-Supervisor reconciler renderer's per-child bundle emit) would have re-added a third and fourth clone of the same record — exactly the "render-side patterns recurring ≥2 times acrosscaixa-helm/caixa-flux/caixa-mesh` become helpers. Duplication is a bug. (PRIME DIRECTIVE.)“ compounding-mandate slot item.
Both prior arms remain as public pub type BundleFile = caixa_core::RenderedFile; / pub type ChartFile = caixa_core::RenderedFile; aliases at their crate boundary so every
existing struct-literal construction site
(BundleFile { path: …, contents: … } / ChartFile { path: …, contents: … }), every field-access site (.path / .contents),
and every derive-fed navigator (== equality pins, Debug
formatting probes) resolves through the type alias to the canonical
RenderedFile with no per-call-site edit — Rust type aliases
carry the same #[derive]-generated Debug/Clone/PartialEq/
Eq impls as their canonical, so the shared-shape contract lives
at one type definition instead of two verbatim clones drifting
silently on any future rebrand.
Peer to the KindMismatch / ServicoCountMismatch typed-view
lifts on the sibling per-renderer-error-diagnostic-shape axis: both
families lift a per-renderer duplicated record onto a canonical
substrate-side type, so a future per-target renderer joins the
pattern by re-exporting one alias instead of open-coding another
clone.
The path axis carries the sandboxed relative path — the same
is_sandboxed_relative_path discipline the Caixa::validate_code_paths
invariant enforces at the manifest-side path axis. No renderer today
runs the predicate against the emit-side per-RenderedFile.path
— the paths are picked from substrate-canonical &'static str
filename constants (FLUX_GITREPOSITORY_YAML_FILENAME,
FLUX_HELMRELEASE_YAML_FILENAME, FLUX_KUSTOMIZATION_YAML_FILENAME,
HELM_CHART_YAML_FILENAME, HELM_VALUES_YAML_FILENAME) rather
than author input, so a per-emit-time sandbox check would be
belt-and-suspenders — but the shared type shape makes a future
sandbox-at-emit-time invariant a one-place add across every
per-target renderer.
Fields§
§path: PathBufSandboxed relative path the substrate writes the artifact under
(relative to the renderer-chosen output root). Substrate-canonical
filename constants (FLUX_GITREPOSITORY_YAML_FILENAME /
FLUX_HELMRELEASE_YAML_FILENAME /
FLUX_KUSTOMIZATION_YAML_FILENAME for the caixa-flux
[cluster_bundle] Flux v2 CR trio, HELM_CHART_YAML_FILENAME /
HELM_VALUES_YAML_FILENAME for the caixa-helm
lareira-<nome> chart directory) source every path today.
contents: StringThe rendered byte contents — a pre-serialized UTF-8 body every
downstream writer (caixa-flux::cluster_bundle’s
per-GitRepository/HelmRelease/Kustomization YAML emit,
caixa-helm::render_chart_for_servico’s per-Chart.yaml/
values.yaml/README.md chart-directory emit) hands to
std::fs::write verbatim under the paired Self::path.
Implementations§
Source§impl RenderedFile
impl RenderedFile
Sourcepub fn new<P, S>(path: P, contents: S) -> Self
pub fn new<P, S>(path: P, contents: S) -> Self
Construct a RenderedFile from its two axes — the sandboxed
relative path the substrate writes the artifact under and the
pre-serialized UTF-8 contents the paired std::fs::write
hands to that path. Accepts anything convertible into a
PathBuf (&'static str from the substrate-canonical
filename constants HELM_CHART_YAML_FILENAME /
HELM_VALUES_YAML_FILENAME / FLUX_GITREPOSITORY_YAML_FILENAME
/ FLUX_HELMRELEASE_YAML_FILENAME /
FLUX_KUSTOMIZATION_YAML_FILENAME every current per-target
renderer picks its per-artifact leaf path from, String /
PathBuf for future author-supplied paths) and anything
convertible into String (the serde_yaml::to_string /
format! outputs every current renderer already threads into
the paired contents field).
Lifted from six identical-shape struct-literal construction
sites — three per-artifact leaves in
caixa-helm’s render_chart_for_servico_with
(Chart.yaml, values.yaml, README.md) and three per-CR
leaves in caixa-flux’s cluster_bundle
(gitrepository.yaml, helmrelease.yaml,
kustomization.yaml) — each of which open-coded a four-line
<Xxx>File { path: PathBuf::from(FILENAME_CONST), contents: <body> }
block that re-derived the same PathBuf::from(&str) wrap +
the same two-field assembly. Every existing struct-
literal construction (the type-alias identity pins at
[caixa_flux::tests::bundle_file_alias_resolves_to_caixa_core_rendered_file]
/ [caixa_helm::tests::chart_file_alias_resolves_to_caixa_core_rendered_file],
the substrate-side field-shape pins in this crate’s test
module) continues to compile — RenderedFile::new is an
additive inherent constructor that leaves the pub path /
pub contents field visibility untouched, so a future rebrand
on the record shape (a per-artifact hash / provenance field
addition, a per-artifact write-mode discriminator once
per-cluster-writer sandboxing lands) still reaches every
per-target renderer through this canonical constructor + the
existing struct-literal pinning by construction. Peer to the
sibling substrate-side canonical-composer surface
(oci_chart_ref / cilium_network_policy_name /
gateway_api_http_route_name / lareira_chart_name) —
each is a canonical &'static fn(&str, …) -> String composer
that every per-target renderer routes through instead of
re-deriving the same encoding inline.
A future per-target renderer (caixa-otel’s per-collector-
config emit, the future mesh.pleme.io/v1alpha1/Aplicacao CR
materializer’s per-CR YAML emit, the future per-Supervisor
reconciler renderer’s per-child bundle emit) that constructs a
RenderedFile now reaches for RenderedFile::new and
participates in the same substrate-side per-artifact-
construction contract, so any addition here (say, a
sandboxed_relative_path invariant check on path at
construction time, the is_sandboxed_relative_path
discipline the docstring above acknowledges is not yet run at
emit time) reaches every per-target renderer through one
caixa-core edit instead of a coordinated six-site rewrite.
Trait Implementations§
Source§impl Clone for RenderedFile
impl Clone for RenderedFile
Source§fn clone(&self) -> RenderedFile
fn clone(&self) -> RenderedFile
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RenderedFile
impl Debug for RenderedFile
impl Eq for RenderedFile
Source§impl PartialEq for RenderedFile
impl PartialEq for RenderedFile
impl StructuralPartialEq for RenderedFile
Auto Trait Implementations§
impl Freeze for RenderedFile
impl RefUnwindSafe for RenderedFile
impl Send for RenderedFile
impl Sync for RenderedFile
impl Unpin for RenderedFile
impl UnsafeUnpin for RenderedFile
impl UnwindSafe for RenderedFile
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.