Skip to content

Commit

Permalink
Implement PartialOrd and Ord for Utf8Bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
sdroege authored and daniel-abramov committed Feb 18, 2025
1 parent 34e417b commit 4eb26c5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/protocol/frame/utf8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ impl std::borrow::Borrow<str> for Utf8Bytes {
}
}

impl PartialOrd for Utf8Bytes {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}

impl Ord for Utf8Bytes {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.as_str().cmp(other.as_str())
}
}

impl<T> PartialEq<T> for Utf8Bytes
where
for<'a> &'a str: PartialEq<T>,
Expand Down

0 comments on commit 4eb26c5

Please sign in to comment.