Skip to main content

just_string/
traits_p.rs

1use std::{
2    borrow::Cow,
3    path::{Path, PathBuf},
4};
5
6use crate::JustString;
7
8impl PartialEq for JustString<'_> {
9    fn eq(&self, other: &Self) -> bool {
10        **self == **other
11    }
12}
13
14impl PartialEq<&str> for JustString<'_> {
15    fn eq(&self, other: &&str) -> bool {
16        &**self == *other
17    }
18}
19
20impl PartialEq<JustString<'_>> for &str {
21    fn eq(&self, other: &JustString<'_>) -> bool {
22        *self == &**other
23    }
24}
25
26impl<'a> PartialEq<Cow<'a, str>> for JustString<'_> {
27    fn eq(&self, other: &Cow<'a, str>) -> bool {
28        &**self == other
29    }
30}
31
32impl PartialEq<JustString<'_>> for Cow<'_, str> {
33    fn eq(&self, other: &JustString<'_>) -> bool {
34        self == &**other
35    }
36}
37
38impl PartialEq<Path> for JustString<'_> {
39    fn eq(&self, other: &Path) -> bool {
40        &**self == other
41    }
42}
43
44impl PartialEq<JustString<'_>> for Path {
45    fn eq(&self, other: &JustString<'_>) -> bool {
46        self == &**other
47    }
48}
49
50impl PartialEq<PathBuf> for JustString<'_> {
51    fn eq(&self, other: &PathBuf) -> bool {
52        &**self == other
53    }
54}
55
56impl PartialEq<JustString<'_>> for PathBuf {
57    fn eq(&self, other: &JustString<'_>) -> bool {
58        self == &**other
59    }
60}
61
62impl PartialEq<str> for JustString<'_> {
63    fn eq(&self, other: &str) -> bool {
64        &**self == other
65    }
66}
67
68impl PartialEq<JustString<'_>> for str {
69    fn eq(&self, other: &JustString<'_>) -> bool {
70        self == &**other
71    }
72}
73
74impl PartialOrd for JustString<'_> {
75    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
76        Some(self.cmp(other))
77    }
78}