diff --git a/src/cache/mod.rs b/src/cache/mod.rs index 6190435..c03812c 100644 --- a/src/cache/mod.rs +++ b/src/cache/mod.rs @@ -40,6 +40,17 @@ impl PartialEq for KeyRef { impl Eq for KeyRef {} +impl PartialOrd for KeyRef { + fn partial_cmp(&self, other: &Self) -> Option { + self.k.partial_cmp(&other.k) + } +} + +impl Ord for KeyRef { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + self.k.cmp(&other.k) + } +} // 确保新类型与其内部类型的内存布局完全相同 #[repr(transparent)]