oxilean_kernel/arena/
idx_traits.rs1use super::types::Idx;
18
19impl<T> std::fmt::Debug for Idx<T> {
20 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21 write!(f, "Idx({})", self.raw)
22 }
23}
24
25impl<T> std::fmt::Display for Idx<T> {
26 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27 write!(f, "{}", self.raw)
28 }
29}
30
31impl<T> PartialEq for Idx<T> {
32 fn eq(&self, other: &Self) -> bool {
33 self.raw == other.raw
34 }
35}
36
37impl<T> Eq for Idx<T> {}
38
39impl<T> std::hash::Hash for Idx<T> {
40 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
41 self.raw.hash(state);
42 }
43}
44
45impl<T> PartialOrd for Idx<T> {
46 fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
47 Some(self.cmp(other))
48 }
49}
50
51impl<T> Ord for Idx<T> {
52 fn cmp(&self, other: &Self) -> std::cmp::Ordering {
53 self.raw.cmp(&other.raw)
54 }
55}