Skip to main content

compose_layers

Function compose_layers 

Source
pub fn compose_layers(
    layers: &[Vec<PatchOptions>],
    warn: impl FnMut(&str),
) -> Vec<EntryOptions>
Expand description

Compose patch layers into the effective entry list over an empty root.

All layers flatten into a single apply_entry_patches call — the same single call a boot makes, never one call per layer. The single-pass id index never sees rows a plain config replacement introduced inside a group, so a later layer targeting such a row warns and misses; composing layer-by-layer would rebuild the index between layers and produce a tree boot never mounts. Composers must keep this shape.

§Example

use cordis_include::{compose_layers, EntryOptions, PatchOptions};

let bundle = vec![PatchOptions {
    insert: Some(vec![EntryOptions::new("adapter-http").with_id("http")]),
    ..Default::default()
}];
let user = vec![PatchOptions {
    id: Some("http".into()),
    disabled: Some(true),
    ..Default::default()
}];
let entries = compose_layers(&[bundle, user], |_| {});
assert_eq!(entries.len(), 1);
assert!(entries[0].disabled);