Skip to main content

materialize_ops

Function materialize_ops 

Source
pub fn materialize_ops(
    input: &[DirectiveWrapper],
    output: &PluginOutput,
) -> Vec<DirectiveWrapper>
Expand description

Materialize a plugin’s ops against its input directive list, producing the resulting flat list of wrappers.

Used by tests that want to inspect a plugin’s effective output without going through the loader’s apply_plugin_ops. The mapping is:

  • Keep(i)input[i].clone()
  • Modify(_, w) and Insert(w)w.clone()
  • Delete(_) → omitted

Unlike the loader’s apply_plugin_ops — which emits a plugin error and bails on protocol violations — this helper panics in debug builds if the ops set isn’t a complete partition over input (each input index appears exactly once across Keep / Modify / Delete). The assert is debug-only so release builds and fuzz targets don’t pay for it; it’s there to make plugin-author mistakes loud in unit tests instead of silently producing surprising materialization.