Merge rust-bitcoin/rust-secp256k1#659: Implement `Ord` for `SerializedSignature`

e55c1f0960 Implement `Ord` for `SerializedSignature` (Martin Habovstiak)

Pull request description:

ACKs for top commit:
  tcharding:
    ACK e55c1f0960
  apoelstra:
    ACK e55c1f0960

Tree-SHA512: b9a7529f44e5d38ab449af7ee06007f3d0480b31cb21c371190f71bea4e3d9142c6c249fcc5564aa21139c0bdcd3951823cea70f29a63f3ef6d35b7e9c7a8e8c
This commit is contained in:
Andrew Poelstra 2023-11-01 20:50:37 +00:00
commit 09810e7fd8
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 22 additions and 0 deletions

View File

@ -53,6 +53,28 @@ impl PartialEq<SerializedSignature> for [u8] {
fn eq(&self, other: &SerializedSignature) -> bool { *self == **other } fn eq(&self, other: &SerializedSignature) -> bool { *self == **other }
} }
impl PartialOrd for SerializedSignature {
fn partial_cmp(&self, other: &SerializedSignature) -> Option<core::cmp::Ordering> {
Some((**self).cmp(&**other))
}
}
impl Ord for SerializedSignature {
fn cmp(&self, other: &SerializedSignature) -> core::cmp::Ordering { (**self).cmp(&**other) }
}
impl PartialOrd<[u8]> for SerializedSignature {
fn partial_cmp(&self, other: &[u8]) -> Option<core::cmp::Ordering> {
(**self).partial_cmp(other)
}
}
impl PartialOrd<SerializedSignature> for [u8] {
fn partial_cmp(&self, other: &SerializedSignature) -> Option<core::cmp::Ordering> {
self.partial_cmp(&**other)
}
}
impl core::hash::Hash for SerializedSignature { impl core::hash::Hash for SerializedSignature {
fn hash<H: core::hash::Hasher>(&self, state: &mut H) { (**self).hash(state) } fn hash<H: core::hash::Hasher>(&self, state: &mut H) { (**self).hash(state) }
} }