Skip to content

Commit

Permalink
ord
Browse files Browse the repository at this point in the history
  • Loading branch information
tickbh committed Jun 15, 2024
1 parent 461fd06 commit 8f305c4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ impl<K: PartialEq> PartialEq for KeyRef<K> {

impl<K: Eq> Eq for KeyRef<K> {}

impl<K: Eq> PartialOrd for KeyRef<K> {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.k.partial_cmp(&other.k)
}
}

impl<K: Eq> Ord for KeyRef<K> {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.k.cmp(&other.k)
}
}

// 确保新类型与其内部类型的内存布局完全相同
#[repr(transparent)]
Expand Down

0 comments on commit 8f305c4

Please sign in to comment.