ckb_fixed_hash_core/
std_cmp.rs1use crate::{H160, H256, H512, H520};
2
3macro_rules! impl_cmp {
4 ($name:ident, $bytes_size:expr) => {
5 impl ::std::cmp::PartialEq for $name {
6 #[inline]
7 fn eq(&self, other: &Self) -> bool {
8 &self.0[..] == &other.0[..]
9 }
10 }
11 impl ::std::cmp::Eq for $name {}
12 impl ::std::cmp::Ord for $name {
13 #[inline]
14 fn cmp(&self, other: &Self) -> ::std::cmp::Ordering {
15 self.0[..].cmp(&other.0[..])
16 }
17 }
18 impl ::std::cmp::PartialOrd for $name {
19 #[inline]
20 fn partial_cmp(&self, other: &Self) -> Option<::std::cmp::Ordering> {
21 Some(self.cmp(other))
22 }
23 }
24 };
25}
26
27impl_cmp!(H160, 20);
28impl_cmp!(H256, 32);
29impl_cmp!(H512, 64);
30impl_cmp!(H520, 65);