pub struct ScumCtx<'v> { /* private fields */ }Expand description
Column-edit batch context. Construct via ScumCtx::new after
calling Vxl::reserve_edit_capacity on the world.
Holds a &mut Vxl borrow plus the rolling 3-row b2 buffer cache.
Mutate columns via ScumCtx::scum2 — it returns the b2 buffer
for the requested column; mutate via delslab / insslab.
Edits are committed when the y row advances (or when
ScumCtx::finish drains the last 2 rows).
Caller MUST invoke ScumCtx::finish explicitly. Drop without
finish leaks the trailing 2 rows of edits — voxlap’s contract.
Implementations§
Source§impl<'v> ScumCtx<'v>
impl<'v> ScumCtx<'v>
Sourcepub fn new(vxl: &'v mut Vxl) -> Self
pub fn new(vxl: &'v mut Vxl) -> Self
Open a new column-edit batch on a Vxl. The Vxl MUST have been
upgraded with Vxl::reserve_edit_capacity beforehand (the
slab allocator must be initialised).
§Panics
Panics if vxl.vbit is empty (no edit capacity reserved).
Sourcepub fn set_colfunc<F>(&mut self, f: F)
pub fn set_colfunc<F>(&mut self, f: F)
Install the color callback. Voxlap’s vx5.colfunc. Called
for each newly-exposed voxel produced by edits.
Sourcepub fn with_column<F>(&mut self, x: i32, y: i32, f: F) -> bool
pub fn with_column<F>(&mut self, x: i32, y: i32, f: F) -> bool
Edit one column with closure-based access. If (x, y) matches
the immediately-previous successful ScumCtx::scum2 /
with_column call, reuses the cached b2 buffer in radar
(skipping the redundant expandrle that would wipe pending
edits). Otherwise calls scum2 to load the column.
This is the primary edit API for span-style batch operations
where multiple z ranges land on the same column —
set_spans is a thin wrapper. Returns false and skips
the closure if (x, y) is out of world bounds.