splinter_rs/
splinter_ref_ops.rs

1use std::ops::Deref;
2
3use crate::{Splinter, SplinterRef};
4
5impl<B> PartialEq<Splinter> for SplinterRef<B>
6where
7    B: Deref<Target = [u8]>,
8{
9    #[inline]
10    fn eq(&self, other: &Splinter) -> bool {
11        other == self
12    }
13}
14
15impl<B, B2> PartialEq<SplinterRef<B2>> for SplinterRef<B>
16where
17    B: Deref<Target = [u8]>,
18    B2: Deref<Target = [u8]>,
19{
20    fn eq(&self, other: &SplinterRef<B2>) -> bool {
21        self.load_unchecked() == other.load_unchecked()
22    }
23}
24
25impl<B: Deref<Target = [u8]>> Eq for SplinterRef<B> {}