pub struct GridDiff;Expand description
Compute diffs between two grids.
Implementations§
Source§impl GridDiff
impl GridDiff
Sourcepub fn diff(old: &Grid, new: &Grid) -> Patch
pub fn diff(old: &Grid, new: &Grid) -> Patch
Full diff: compare every cell between old and new.
O(rows * cols). Use diff_dirty for typical sub-linear performance.
Sourcepub fn diff_dirty(old: &Grid, new: &Grid, tracker: &DirtyTracker) -> Patch
pub fn diff_dirty(old: &Grid, new: &Grid, tracker: &DirtyTracker) -> Patch
Dirty-hinted diff: only compare cells in dirty rows/spans.
Skips clean rows entirely and within dirty rows only checks the indicated spans. This achieves sub-linear performance for typical workloads where only 1-5 rows change per frame.
Soundness: the caller must ensure the DirtyTracker has been
correctly maintained (all modified cells are marked dirty). If a cell
was modified but not marked, the change will be missed.
Auto Trait Implementations§
impl Freeze for GridDiff
impl RefUnwindSafe for GridDiff
impl Send for GridDiff
impl Sync for GridDiff
impl Unpin for GridDiff
impl UnwindSafe for GridDiff
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