Implement `Ord` for `SerializedSignature`

This commit is contained in:
Martin Habovstiak 2023-10-31 19:57:26 +01:00
parent fe2905d8e3
commit e55c1f0960
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) }
} }