pub struct Dirty<const N: usize> { /* private fields */ }Expand description
Dirty bitmap type state - bitmap has pending mutations not yet committed.
§De-duplication and Cancellation
The dirty state de-duplicates during operations, not at commit time.
Operations that cancel out are handled automatically:
Example 1: push + pop = no-op
push(true) → appended_bits=[true], projected_len=11
pop() → appended_bits=[], projected_len=10
Result: dirty state unchanged from base
Example 2: set_bit + set_bit = last write wins
set_bit(5, true) → modified_bits={5: true}
set_bit(5, false) → modified_bits={5: false}
Result: only final value recorded
Example 3: set_bit + pop = cancels modification
set_bit(9, true) → modified_bits={9: true}
pop() → modified_bits={} (removed), projected_len=9
Result: bit 9 no longer exists, modification discarded§Key Invariants
- Base immutability:
base_lenandbase_pruned_chunksnever change - Appended region: Always occupies
[projected_len - appended_bits.len(), projected_len) - Modified region:
modified_bitsonly contains offsets in[0, projected_len - appended_bits.len())- These are modifications to the base bitmap, never to appended bits
- Appended bits are modified by directly updating the
appended_bitsvector
- No overlap: A bit is either in
modified_bitsORappended_bits, never both
Trait Implementations§
impl<const N: usize> State for Dirty<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for Dirty<N>
impl<const N: usize> RefUnwindSafe for Dirty<N>
impl<const N: usize> Send for Dirty<N>
impl<const N: usize> Sync for Dirty<N>
impl<const N: usize> Unpin for Dirty<N>
impl<const N: usize> UnwindSafe for Dirty<N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more