vimwiki_core/
utils.rs

1/// Represents an equality check that is considered strict. In the case of
2/// a `Located<T>`, will check both the inner type AND the region.
3pub trait StrictEq<Rhs: ?Sized = Self> {
4    fn strict_eq(&self, other: &Rhs) -> bool;
5
6    #[inline]
7    fn strict_ne(&self, other: &Rhs) -> bool {
8        !self.strict_eq(other)
9    }
10}
11
12/// Blanket implementation for two vectors of similarly-typed StrictEq elements
13impl<T: StrictEq> StrictEq for Vec<T> {
14    /// Performs strict_eq check on inner elements
15    fn strict_eq(&self, other: &Self) -> bool {
16        self.len() == other.len()
17            && self.iter().zip(other.iter()).all(|(x, y)| x.strict_eq(y))
18    }
19}