#[non_exhaustive]pub struct ListDiff {
pub old_len: u32,
pub new_len: u32,
pub runs: Vec<DiffRun>,
}Expand description
How a list’s rows changed, by key: its new rows in order, as runs of rows kept, moved or inserted. Old rows no run covers were removed.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.old_len: u32How many rows there were.
new_len: u32How many rows there are.
runs: Vec<DiffRun>The new rows in order.
Implementations§
Source§impl ListDiff
impl ListDiff
Sourcepub fn new<K: Copy + Eq + Hash>(old: &[K], new: &[K]) -> Option<Self>
pub fn new<K: Copy + Eq + Hash>(old: &[K], new: &[K]) -> Option<Self>
How the rows with keys old became the rows with keys new;
None when they are the same.
Sourcepub fn new_partial<K: Copy + Eq + Hash>(
old: &[Option<K>],
new: &[Option<K>],
) -> Option<Self>
pub fn new_partial<K: Copy + Eq + Hash>( old: &[Option<K>], new: &[Option<K>], ) -> Option<Self>
ListDiff::new for rows that may have no key (None): such a row
matches no other.
Sourcepub fn splice(old_len: u32, at: u32, removed: u32, inserted: u32) -> Self
pub fn splice(old_len: u32, at: u32, removed: u32, inserted: u32) -> Self
A diff that removes removed rows at at of old_len and inserts
inserted there.
Sourcepub fn widened(self, before: u32, after: u32) -> Self
pub fn widened(self, before: u32, after: u32) -> Self
The diff of rows inside a list: before rows before them and
after rows after them stayed as they were.
Sourcepub fn as_splice(&self) -> Option<(u32, u32, u32)>
pub fn as_splice(&self) -> Option<(u32, u32, u32)>
The change as one splice, (at, removed, inserted), when it is one
(no row moved, and one stretch of rows changed).
Sourcepub fn new_indices(&self) -> Vec<Option<u32>>
pub fn new_indices(&self) -> Vec<Option<u32>>
Each old row’s new index, None for the rows removed.
Trait Implementations§
impl Eq for ListDiff
impl StructuralPartialEq for ListDiff
Auto Trait Implementations§
impl Forget for ListDiff
impl Freeze for ListDiff
impl Move for ListDiff
impl RefUnwindSafe for ListDiff
impl Send for ListDiffwhere
RawVecInner: Send,
impl Sync for ListDiffwhere
RawVecInner: Sync,
impl Unpin for ListDiff
impl UnsafeUnpin for ListDiff
impl UnwindSafe for ListDiffwhere
RawVecInner: UnwindSafe,
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