From 4eb26c5f01ec210cd4ec762baeb32f40c213c0dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 18 Feb 2025 09:53:32 +0200 Subject: [PATCH] Implement `PartialOrd` and `Ord` for `Utf8Bytes` --- src/protocol/frame/utf8.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/protocol/frame/utf8.rs b/src/protocol/frame/utf8.rs index 6d3448b2..e4b442e0 100644 --- a/src/protocol/frame/utf8.rs +++ b/src/protocol/frame/utf8.rs @@ -78,6 +78,18 @@ impl std::borrow::Borrow for Utf8Bytes { } } +impl PartialOrd for Utf8Bytes { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl Ord for Utf8Bytes { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + self.as_str().cmp(other.as_str()) + } +} + impl PartialEq for Utf8Bytes where for<'a> &'a str: PartialEq,