mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
Implemented Default, PartialOrd, and Ord for RocDec
This commit is contained in:
parent
2936a37a1c
commit
b7ec1f143b
2 changed files with 42 additions and 1 deletions
|
@ -289,7 +289,7 @@ impl<T, E> Drop for RocResult<T, E> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, Default)]
|
||||
#[repr(C, align(16))]
|
||||
pub struct RocDec([u8; 16]);
|
||||
|
||||
|
@ -477,6 +477,18 @@ impl fmt::Display for RocDec {
|
|||
}
|
||||
}
|
||||
|
||||
impl PartialOrd for RocDec {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
impl Ord for RocDec {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
self.as_i128().cmp(&other.as_i128())
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C, align(16))]
|
||||
#[derive(Clone, Copy, Eq, Default)]
|
||||
pub struct I128([u8; 16]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue