pub struct DirtyTracker { /* private fields */ }Expand description
Tracks which cells have been modified since the last frame.
Used by GridDiff::diff_dirty to skip unchanged rows and focus only on
dirty spans within changed rows, achieving sub-linear diff cost for
typical workloads (1-5 rows changed per frame).
§Merge gap
When two dirty spans are separated by merge_gap or fewer clean cells,
they are merged into a single span. This reduces overhead from many
tiny spans (e.g., character-by-character typing). Default: 1.
Implementations§
Source§impl DirtyTracker
impl DirtyTracker
Sourcepub fn new(cols: u16, rows: u16) -> Self
pub fn new(cols: u16, rows: u16) -> Self
Create a new tracker for a grid of the given dimensions.
Sourcepub fn set_merge_gap(&mut self, gap: u16)
pub fn set_merge_gap(&mut self, gap: u16)
Set the merge gap for span coalescing.
Sourcepub fn dirty_row_count(&self) -> usize
pub fn dirty_row_count(&self) -> usize
Number of dirty rows.
Sourcepub fn mark_span(&mut self, row: u16, start_col: u16, end_col: u16)
pub fn mark_span(&mut self, row: u16, start_col: u16, end_col: u16)
Mark a horizontal range [start_col, end_col) as dirty.
Sourcepub fn is_row_dirty(&self, row: u16) -> bool
pub fn is_row_dirty(&self, row: u16) -> bool
Whether a specific row is dirty.
Trait Implementations§
Source§impl Clone for DirtyTracker
impl Clone for DirtyTracker
Source§fn clone(&self) -> DirtyTracker
fn clone(&self) -> DirtyTracker
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DirtyTracker
impl RefUnwindSafe for DirtyTracker
impl Send for DirtyTracker
impl Sync for DirtyTracker
impl Unpin for DirtyTracker
impl UnwindSafe for DirtyTracker
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