We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d8c361e commit b49dd1dCopy full SHA for b49dd1d
tendermint/src/block/height.rs
@@ -66,6 +66,18 @@ impl From<u8> for Height {
66
}
67
68
69
+impl PartialEq<u64> for Height {
70
+ fn eq(&self, other: &u64) -> bool {
71
+ self.value() == *other
72
+ }
73
+}
74
+
75
+impl PartialEq<u32> for Height {
76
+ fn eq(&self, other: &u32) -> bool {
77
+ self.value() == *other as u64
78
79
80
81
impl Height {
82
/// Get inner integer value. Alternative to `.0` or `.into()`
83
pub fn value(&self) -> u64 {
@@ -142,4 +154,10 @@ mod tests {
142
154
Height::from(2_u32).value()
143
155
);
144
156
157
158
+ #[test]
159
+ fn equivalence_check() {
160
+ assert!(Height::try_from(10_u64).unwrap() == 10u64);
161
+ assert!(Height::try_from(10_u64).unwrap() == 10u32);
162
145
163
0 commit comments