Skip to main content

file_storage/path/core/
compare.rs

1use crate::path::StoragePath;
2use std::cmp::Ordering;
3use std::hash::{Hash, Hasher};
4
5impl Ord for StoragePath {
6    fn cmp(&self, other: &Self) -> Ordering {
7        self.path().cmp(other.path())
8    }
9}
10
11impl PartialOrd for StoragePath {
12    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
13        Some(self.cmp(other))
14    }
15}
16
17impl Eq for StoragePath {}
18
19impl PartialEq for StoragePath {
20    fn eq(&self, other: &Self) -> bool {
21        self.path().eq(other.path())
22    }
23}
24
25impl Hash for StoragePath {
26    fn hash<H: Hasher>(&self, state: &mut H) {
27        self.path().hash(state)
28    }
29}