Expand description
§BitmaskV Module - Windowed View over an Bitmask
BitmaskV is a logical, zero-copy, read-only window into a contiguous
region of a Bitmask.
§Purpose
- Indexable and bounds-checked access to a subset of a bit-packed mask.
- All logical indices are relative to the window.
- Avoids copying - borrows the parent mask by reference.
§Behaviour
- All operations remap indices internally to the correct positions in the parent mask.
- Window slicing (
slice) is O(1) - pointer and metadata updates only. - Uses a lifetime which can be elided in many engine cases. However, if one needs to copy
it from there it is a deep clone. Given the backing buffer is a bitpacked
u8, this is a materially smaller penalty compared to other Minarrow buffers. This design avoids otherwise threadingArc<Bitmask>through every strongly typed array variant which penalises the default case disproportionately. - Use
to_bitmaskfor a materialised copy of the view.
§Threading
- Thread-safe by virtue of immutability - no interior mutability.
§Performance Notes
- The view borrows the parent mask, so constructing or slicing it avoids allocating.
Materialise with
to_bitmaskwhen an owned, windowed copy is required.
§Related
Structs§
- BitmaskV
- BitmaskView