Skip to content

Commit

Permalink
Implement Ord for SerializedSignature
Browse files Browse the repository at this point in the history
  • Loading branch information
Kixunil committed Oct 31, 2023
1 parent fe2905d commit c3aa3bb
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/ecdsa/serialized_signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,30 @@ impl PartialEq<SerializedSignature> for [u8] {
fn eq(&self, other: &SerializedSignature) -> bool { *self == **other }
}

impl PartialOrd for SerializedSignature {
fn partial_cmp(&self, other: &SerializedSignature) -> Option<core::cmp::Ordering> {
(**self).partial_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 {
fn hash<H: core::hash::Hasher>(&self, state: &mut H) { (**self).hash(state) }
}
Expand Down

0 comments on commit c3aa3bb

Please sign in to comment.