diff options
Diffstat (limited to 'crates/smol_str')
-rw-r--r-- | crates/smol_str/src/lib.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/smol_str/src/lib.rs b/crates/smol_str/src/lib.rs index 41c3a39ef..79b179ef4 100644 --- a/crates/smol_str/src/lib.rs +++ b/crates/smol_str/src/lib.rs | |||
@@ -49,6 +49,30 @@ impl<'a> PartialEq<SmolStr> for &'a str { | |||
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | impl PartialEq<String> for SmolStr { | ||
53 | fn eq(&self, other: &String) -> bool { | ||
54 | self.as_str() == other | ||
55 | } | ||
56 | } | ||
57 | |||
58 | impl PartialEq<SmolStr> for String { | ||
59 | fn eq(&self, other: &SmolStr) -> bool { | ||
60 | other == self | ||
61 | } | ||
62 | } | ||
63 | |||
64 | impl<'a> PartialEq<&'a String> for SmolStr { | ||
65 | fn eq(&self, other: &&'a String) -> bool { | ||
66 | self == *other | ||
67 | } | ||
68 | } | ||
69 | |||
70 | impl<'a> PartialEq<SmolStr> for &'a String { | ||
71 | fn eq(&self, other: &SmolStr) -> bool { | ||
72 | *self == other | ||
73 | } | ||
74 | } | ||
75 | |||
52 | impl fmt::Debug for SmolStr { | 76 | impl fmt::Debug for SmolStr { |
53 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | 77 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
54 | fmt::Debug::fmt(self.as_str(), f) | 78 | fmt::Debug::fmt(self.as_str(), f) |