Skip to main content

validate_op_coverage

Function validate_op_coverage 

Source
pub fn validate_op_coverage(n: usize, ops: &[PluginOp]) -> Result<(), String>
Expand description

Validate that ops form a complete, non-overlapping cover of the input.

Every one of the n input directives must appear in exactly one of Keep/Modify/Delete, with no out-of-bounds or duplicate references. PluginOp::Insert adds new directives and references no input index.

This is the single source of truth for the plugin-op contract, shared by the loader’s in-pipeline pass (rustledger_loader::process::apply_plugin_ops) and the FFI’s requested-plugin pass (rustledger_ffi_wasi::helpers), so the two surfaces cannot drift on what a well-formed op set is. The representation-specific materialization (span preservation, posting-span sanitization) stays with each caller.

§Errors

Returns a human-readable message describing the first violation found (out-of-bounds index, an index referenced more than once, or an input directive omitted from every Keep/Modify/Delete).