Skip to content

Commit e55c1f0

Browse files
committed
Implement Ord for SerializedSignature
1 parent fe2905d commit e55c1f0

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)