strict_path/path/strict_path/
traits.rs1use super::StrictPath;
2use std::cmp::Ordering;
3use std::fmt;
4use std::hash::{Hash, Hasher};
5use std::path::Path;
6
7impl<Marker> fmt::Debug for StrictPath<Marker> {
8 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
9 f.debug_struct("StrictPath")
10 .field("path", &self.path())
11 .field("boundary", &self.boundary_path())
12 .field("marker", &std::any::type_name::<Marker>())
13 .finish()
14 }
15}
16
17impl<Marker> PartialEq for StrictPath<Marker> {
18 #[inline]
19 fn eq(&self, other: &Self) -> bool {
20 self.path() == other.path()
21 }
22}
23
24impl<Marker> Eq for StrictPath<Marker> {}
25
26impl<Marker> Hash for StrictPath<Marker> {
27 #[inline]
28 fn hash<H: Hasher>(&self, state: &mut H) {
29 self.path().hash(state);
30 }
31}
32
33impl<Marker> PartialOrd for StrictPath<Marker> {
34 #[inline]
35 fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
36 Some(self.cmp(other))
37 }
38}
39
40impl<Marker> Ord for StrictPath<Marker> {
41 #[inline]
42 fn cmp(&self, other: &Self) -> Ordering {
43 self.path().cmp(other.path())
44 }
45}
46
47impl<T: AsRef<Path>, Marker> PartialEq<T> for StrictPath<Marker> {
48 fn eq(&self, other: &T) -> bool {
49 self.path() == other.as_ref()
50 }
51}
52
53impl<T: AsRef<Path>, Marker> PartialOrd<T> for StrictPath<Marker> {
54 fn partial_cmp(&self, other: &T) -> Option<Ordering> {
55 Some(self.path().cmp(other.as_ref()))
56 }
57}
58
59#[cfg(feature = "virtual-path")]
60impl<Marker> PartialEq<crate::path::virtual_path::VirtualPath<Marker>> for StrictPath<Marker> {
61 #[inline]
62 fn eq(&self, other: &crate::path::virtual_path::VirtualPath<Marker>) -> bool {
63 self.path() == other.interop_path()
64 }
65}