1use std::borrow::Cow;
20use std::cmp::Ordering;
21use std::path::Path;
22use std::path::PathBuf;
23
24use super::BasePath;
25use super::BasePathBuf;
26
27macro_rules! r#impl {
28 ( $left:ty , $right:ty ) => {
29 impl PartialEq<$right> for $left {
30 #[inline]
31 fn eq(&self, other: &$right) -> bool {
32 <BasePath as PartialEq<Path>>::eq(self, other.as_ref())
33 }
34 }
35
36 impl PartialEq<$left> for $right {
37 #[inline]
38 fn eq(&self, other: &$left) -> bool {
39 other == self
40 }
41 }
42
43 impl PartialOrd<$right> for $left {
44 #[inline]
45 fn partial_cmp(&self, other: &$right) -> Option<Ordering> {
46 <BasePath as PartialOrd<Path>>::partial_cmp(
47 self,
48 other.as_ref(),
49 )
50 }
51 }
52
53 impl PartialOrd<$left> for $right {
54 #[inline]
55 fn partial_cmp(&self, other: &$left) -> Option<Ordering> {
56 other.partial_cmp(self)
57 }
58 }
59 };
60}
61
62r#impl!(BasePathBuf, BasePath);
63r#impl!(BasePathBuf, &BasePath);
64r#impl!(Cow<'_, BasePath>, BasePath);
65r#impl!(Cow<'_, BasePath>, &BasePath);
66r#impl!(Cow<'_, BasePath>, BasePathBuf);
67
68r#impl!(BasePathBuf, Path);
69r#impl!(BasePathBuf, &Path);
70r#impl!(BasePathBuf, Cow<'_, Path>);
71r#impl!(BasePathBuf, PathBuf);
72r#impl!(BasePath, &Path);
73r#impl!(BasePath, Cow<'_, Path>);
74r#impl!(BasePath, PathBuf);
75r#impl!(&BasePath, Path);
76r#impl!(&BasePath, Cow<'_, Path>);
77r#impl!(&BasePath, PathBuf);