pub struct HashSetDiff<'daft, K: Hash + Eq> {
pub common: HashSet<&'daft K>,
pub added: HashSet<&'daft K>,
pub removed: HashSet<&'daft K>,
}Available on crate feature
std only.Expand description
A diff of two HashSet instances.
The diff contains three elements:
common: Entries that are present in both sets.added: Entries present inafter, but not inbefore.removed: Entries present inbefore, but not inafter.
§Example
use daft::{Diffable, HashSetDiff};
use std::collections::HashSet;
let a: HashSet<usize> = [0, 1].into_iter().collect();
let b: HashSet<usize> = [1, 2].into_iter().collect();
let changes = a.diff(&b);
let expected = HashSetDiff {
// Entries are stored by reference and matched by equality.
common: [&1].into_iter().collect(),
added: [&2].into_iter().collect(),
removed: [&0].into_iter().collect(),
};
assert_eq!(changes, expected);Fields§
§common: HashSet<&'daft K>Entries common to both sets.
added: HashSet<&'daft K>Entries present in the after set, but not in before.
removed: HashSet<&'daft K>Entries present in the before set, but not in after.
Implementations§
Trait Implementations§
impl<'daft, K: Eq + Hash + Eq> Eq for HashSetDiff<'daft, K>
impl<'daft, K: Hash + Eq> StructuralPartialEq for HashSetDiff<'daft, K>
Auto Trait Implementations§
impl<'daft, K> Freeze for HashSetDiff<'daft, K>
impl<'daft, K> RefUnwindSafe for HashSetDiff<'daft, K>where
K: RefUnwindSafe,
impl<'daft, K> Send for HashSetDiff<'daft, K>where
K: Sync,
impl<'daft, K> Sync for HashSetDiff<'daft, K>where
K: Sync,
impl<'daft, K> Unpin for HashSetDiff<'daft, K>
impl<'daft, K> UnwindSafe for HashSetDiff<'daft, K>where
K: RefUnwindSafe,
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