aboutsummaryrefslogtreecommitdiff
path: root/crates/smol_str
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-13 14:07:05 +0100
committerAleksey Kladov <[email protected]>2018-08-13 14:07:05 +0100
commit7fc91f41d8bd948cef3085d7c0d0ec92d1b2bc53 (patch)
treed671181833c0af18fdfd167998cae1afbe759926 /crates/smol_str
parent0568e76406fc4869152671a255c5e1efca6611a6 (diff)
Generalize query
Diffstat (limited to 'crates/smol_str')
-rw-r--r--crates/smol_str/src/lib.rs24
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
52impl PartialEq<String> for SmolStr {
53 fn eq(&self, other: &String) -> bool {
54 self.as_str() == other
55 }
56}
57
58impl PartialEq<SmolStr> for String {
59 fn eq(&self, other: &SmolStr) -> bool {
60 other == self
61 }
62}
63
64impl<'a> PartialEq<&'a String> for SmolStr {
65 fn eq(&self, other: &&'a String) -> bool {
66 self == *other
67 }
68}
69
70impl<'a> PartialEq<SmolStr> for &'a String {
71 fn eq(&self, other: &SmolStr) -> bool {
72 *self == other
73 }
74}
75
52impl fmt::Debug for SmolStr { 76impl 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)