mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 16:44:33 +00:00
Add Ord and PartialOrd to RocStr
This commit is contained in:
parent
6efe5085b6
commit
e2fe23b0dd
1 changed files with 12 additions and 0 deletions
|
@ -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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue