Struct lattices::union_find::UnionFind
source · pub struct UnionFind<Map>(/* private fields */);
Expand description
Union-find lattice.
Each value of K
in the map represents an item in a set. When two lattices instances are
merged, any sets with common elements will be unioned together.
[Self::union(a, b)
] unions two sets together, which is equivalent to merging in a
UnionFindSingletonMap
atom of (a, b)
(or (b, a)
).
Any union-find consisting only of singleton sets is bottom.
§Hasse diagram of partitions of a set of size four:
Implementations§
source§impl<Map> UnionFind<Map>
impl<Map> UnionFind<Map>
sourcepub fn as_reveal_ref(&self) -> &Map
pub fn as_reveal_ref(&self) -> &Map
Reveal the inner value as a shared reference.
sourcepub fn as_reveal_mut(&mut self) -> &mut Map
pub fn as_reveal_mut(&mut self) -> &mut Map
Reveal the inner value as an exclusive reference.
sourcepub fn into_reveal(self) -> Map
pub fn into_reveal(self) -> Map
Gets the inner by value, consuming self.
Trait Implementations§
source§impl<Map, K> Atomize for UnionFind<Map>
impl<Map, K> Atomize for UnionFind<Map>
source§impl<Map> DeepReveal for UnionFind<Map>
impl<Map> DeepReveal for UnionFind<Map>
source§impl<'de, Map> Deserialize<'de> for UnionFind<Map>where
Map: Deserialize<'de>,
impl<'de, Map> Deserialize<'de> for UnionFind<Map>where
Map: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<MapSelf, MapOther, K> LatticeFrom<UnionFind<MapOther>> for UnionFind<MapSelf>where
MapSelf: Keyed<Key = K, Item = Cell<K>> + FromIterator<(K, Cell<K>)>,
MapOther: IntoIterator<Item = (K, Cell<K>)>,
K: Copy + Eq,
impl<MapSelf, MapOther, K> LatticeFrom<UnionFind<MapOther>> for UnionFind<MapSelf>where
MapSelf: Keyed<Key = K, Item = Cell<K>> + FromIterator<(K, Cell<K>)>,
MapOther: IntoIterator<Item = (K, Cell<K>)>,
K: Copy + Eq,
source§fn lattice_from(other: UnionFind<MapOther>) -> Self
fn lattice_from(other: UnionFind<MapOther>) -> Self
Convert from the
Other
lattice into Self
.source§impl<MapSelf, MapOther, K> PartialOrd<UnionFind<MapOther>> for UnionFind<MapSelf>
impl<MapSelf, MapOther, K> PartialOrd<UnionFind<MapOther>> for UnionFind<MapSelf>
impl<Map: Copy> Copy for UnionFind<Map>
impl<Map> Eq for UnionFind<Map>where
Self: PartialEq,
impl<MapSelf, MapOther> LatticeOrd<UnionFind<MapOther>> for UnionFind<MapSelf>where
Self: PartialOrd<UnionFind<MapOther>>,
Auto Trait Implementations§
impl<Map> Freeze for UnionFind<Map>where
Map: Freeze,
impl<Map> RefUnwindSafe for UnionFind<Map>where
Map: RefUnwindSafe,
impl<Map> Send for UnionFind<Map>where
Map: Send,
impl<Map> Sync for UnionFind<Map>where
Map: Sync,
impl<Map> Unpin for UnionFind<Map>where
Map: Unpin,
impl<Map> UnwindSafe for UnionFind<Map>where
Map: 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
source§impl<This, Other> NaiveLatticeOrd<Other> for This
impl<This, Other> NaiveLatticeOrd<Other> for This
source§fn naive_cmp(&self, other: &Rhs) -> Option<Ordering>
fn naive_cmp(&self, other: &Rhs) -> Option<Ordering>
Naive compare based on the
Merge::merge
method. This method can be very inefficient;
use PartialOrd::partial_cmp
instead. Read more