Skip to main content

lightshuttle_export/
emit.rs

1//! The emitter contract: turn an [`ExportModel`] into target files.
2
3use crate::error::Result;
4use crate::model::{ExportArtifacts, ExportModel, Target};
5
6/// Transpiles an [`ExportModel`] into the files of a single target.
7///
8/// Implementations live in their own modules (compose, kubernetes,
9/// helm). Emitters must produce deterministic output: container
10/// environment maps are unordered, so any map-derived output has to be
11/// sorted by key before it is written, otherwise golden-file tests turn
12/// flaky.
13pub trait Emitter {
14    /// The target this emitter produces.
15    fn target(&self) -> Target;
16
17    /// Emit the target files for `model`.
18    fn emit(&self, model: &ExportModel) -> Result<ExportArtifacts>;
19}