Skip to main content

ScumCtx

Struct ScumCtx 

Source
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>

Source

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).

Source

pub fn set_colfunc<F>(&mut self, f: F)
where F: FnMut(i32, i32, i32) -> i32 + 'v,

Install the color callback. Voxlap’s vx5.colfunc. Called for each newly-exposed voxel produced by edits.

Source

pub fn scum2(&mut self, x: i32, y: i32) -> Option<&mut [i32]>

Open column (x, y) for editing; returns its b2 buffer. Caller mutates via delslab / insslab.

Auto-flushes any prior y row that’s no longer in the rolling window. Returns None if (x, y) is out of world bounds.

Source

pub fn with_column<F>(&mut self, x: i32, y: i32, f: F) -> bool
where F: FnOnce(&mut [i32]),

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.

Source

pub fn finish(self)

Drain the last 2 rows and consume the context. MUST be called — Drop does not auto-finish (voxlap contract).

Auto Trait Implementations§

§

impl<'v> Freeze for ScumCtx<'v>

§

impl<'v> !RefUnwindSafe for ScumCtx<'v>

§

impl<'v> !Send for ScumCtx<'v>

§

impl<'v> !Sync for ScumCtx<'v>

§

impl<'v> Unpin for ScumCtx<'v>

§

impl<'v> UnsafeUnpin for ScumCtx<'v>

§

impl<'v> !UnwindSafe for ScumCtx<'v>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.