Skip to main content

render_config_dump

Function render_config_dump 

Source
pub fn render_config_dump(
    base: &[EntryOptions],
    base_label: &str,
    layers: &[DumpLayer<'_>],
    warn: impl FnMut(&str),
) -> Result<String>
Expand description

Compose layers over base and render the dump in one step — the offline twin of compose_with_provenance plus render_dump. See those for the single-flatten, provenance, and warning-attribution contracts.

§Example

use cordis_include::{render_config_dump, DumpLayer, EntryOptions, PatchOptions};

let base = [EntryOptions::new("./noop").with_id("shared")];
let overlay = [PatchOptions {
    id: Some("shared".into()),
    disabled: Some(true),
    ..Default::default()
}];
let layers = [DumpLayer {
    label: "overlay.yml",
    patches: &overlay,
}];
let dump = render_config_dump(&base, "base.yml", &layers, |_| {}).unwrap();
assert!(dump.contains("# == base.yml, patched by overlay.yml"), "{dump}");