Skip to main content

oxilean_kernel/arena/
idx_traits.rs

1//! # Idx - Trait Implementations
2//!
3//! This module contains trait implementations for `Idx`.
4//!
5//! ## Implemented Traits
6//!
7//! - `Debug`
8//! - `Display`
9//! - `PartialEq`
10//! - `Eq`
11//! - `Hash`
12//! - `PartialOrd`
13//! - `Ord`
14//!
15//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
16
17use 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}