Skip to content

Commit 09810e7

Browse files
committed
Merge #659: Implement Ord for SerializedSignature
e55c1f0 Implement `Ord` for `SerializedSignature` (Martin Habovstiak) Pull request description: ACKs for top commit: tcharding: ACK e55c1f0 apoelstra: ACK e55c1f0 Tree-SHA512: b9a7529f44e5d38ab449af7ee06007f3d0480b31cb21c371190f71bea4e3d9142c6c249fcc5564aa21139c0bdcd3951823cea70f29a63f3ef6d35b7e9c7a8e8c
2 parents fe2905d + e55c1f0 commit 09810e7

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/ecdsa/serialized_signature.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,28 @@ impl PartialEq<SerializedSignature> for [u8] {
5353
fn eq(&self, other: &SerializedSignature) -> bool { *self == **other }
5454
}
5555

56+
impl PartialOrd for SerializedSignature {
57+
fn partial_cmp(&self, other: &SerializedSignature) -> Option<core::cmp::Ordering> {
58+
Some((**self).cmp(&**other))
59+
}
60+
}
61+
62+
impl Ord for SerializedSignature {
63+
fn cmp(&self, other: &SerializedSignature) -> core::cmp::Ordering { (**self).cmp(&**other) }
64+
}
65+
66+
impl PartialOrd<[u8]> for SerializedSignature {
67+
fn partial_cmp(&self, other: &[u8]) -> Option<core::cmp::Ordering> {
68+
(**self).partial_cmp(other)
69+
}
70+
}
71+
72+
impl PartialOrd<SerializedSignature> for [u8] {
73+
fn partial_cmp(&self, other: &SerializedSignature) -> Option<core::cmp::Ordering> {
74+
self.partial_cmp(&**other)
75+
}
76+
}
77+
5678
impl core::hash::Hash for SerializedSignature {
5779
fn hash<H: core::hash::Hasher>(&self, state: &mut H) { (**self).hash(state) }
5880
}

0 commit comments

Comments
 (0)