1use std::cmp::Ordering;
7
8#[derive(Eq, PartialEq)]
9struct Bytes32<'a> {
11 pub store: Vec<[&'a u8; 4]>,
12}
13
14
15impl<'a> Ord for Bytes32<'a> {
16 fn cmp(&self, other: &Bytes32) -> Ordering {
17
18 for _i in 0..3 {
19 if other.store[_i] > self.store[_i] {
20 return Ordering::Greater;
21 }
22 if other.store[_i] < self.store[_i] {
23 return Ordering::Less;
24 }
25 }
26 Ordering::Equal
27 }
28}
29
30impl<'a> PartialOrd for Bytes32<'a> {
31 fn partial_cmp(&self, other: &Bytes32) -> Option<Ordering> {
32 Some(self.cmp(other))
33 }
34}