Skip to main content

diff_rows

Function diff_rows 

Source
pub fn diff_rows(old: &[u64], new: &[u64]) -> Option<Vec<RowDelta>>
Expand description

The row deltas that turn old into new, two lists of row identity tokens, or None when a reload serves better (docs/list.md “Keyed updates”).

The deltas are sequential, as RowDelta defines them: removals first, from the bottom up, then one insert per new row and one move per row that changed its place among the rows that stayed, placed from the bottom up so each lands directly above a row already in place. The moves are the fewest possible: the rows on a longest increasing run keep still.

None when either list is empty, when the two share no row, when a token repeats (a repeated key cannot say which row moved), or when the change needs more than SPLICE_MAX_DELTAS deltas. Some(vec![]) when the lists are equal.