micromap_rawl/set/eq.rs
1use crate::Set;
2
3impl<T: PartialEq, const N: usize> PartialEq for Set<T, N> {
4 /// Two sets can be compared.
5 ///
6 /// For example:
7 ///
8 /// ```
9 /// let mut m1: micromap_rawl::Set<u8, 10> = micromap_rawl::Set::new();
10 /// let mut m2: micromap_rawl::Set<u8, 10> = micromap_rawl::Set::new();
11 /// m1.insert(1);
12 /// m2.insert(1);
13 /// # #[cfg(std)]
14 /// assert_eq!(m1, m2);
15 /// // two sets with different order of key-value pairs are still equal:
16 /// m1.insert(2);
17 /// m1.insert(3);
18 /// m2.insert(3);
19 /// m2.insert(2);
20 /// # #[cfg(std)]
21 /// assert_eq!(m1, m2);
22 /// ```
23 #[inline]
24 fn eq(
25 &self,
26 other: &Self,
27 ) -> bool {
28 self.map.eq(&other.map)
29 }
30}
31
32impl<T: Eq, const N: usize> Eq for Set<T, N> {}