Skip to main content

Module apply

Module apply 

Source
Expand description

Stage application — runtime-side apply_stage.

Lives in runtime/ so the layer DAG abi → state → runtime → persist is preserved (R4-X) — placing it on Instance would force state to import runtime::StepStage.

apply_stage borrows the stage &mut and drains the buckets it commits, so the kernel can reuse one StepStage scratch across actions. The rollback path needs no separate function: the kernel simply skips apply_stage and clear()s the scratch before the next action.

Application is panic-free (totality contract): every operation uses saturating arithmetic and if let Some(...) style guards.