Add Ord and PartialOrd to RocStr

This commit is contained in:
Richard Feldman 2022-05-03 23:50:43 -04:00
parent 6efe5085b6
commit e2fe23b0dd
No known key found for this signature in database
GPG key ID: 7E4127D1E4241798

View file

@ -97,6 +97,18 @@ impl PartialEq for RocStr {
impl Eq for RocStr {} impl Eq for RocStr {}
impl PartialOrd for RocStr {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.as_str().partial_cmp(other.as_str())
}
}
impl Ord for RocStr {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.as_str().cmp(other.as_str())
}
}
impl Debug for RocStr { impl Debug for RocStr {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
self.deref().fmt(f) self.deref().fmt(f)