File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -1109,6 +1109,8 @@ where
1109
1109
}
1110
1110
}
1111
1111
1112
+ // This impl allows a `SymbolStr` to be directly equated with a `String` or
1113
+ // `&str`.
1112
1114
impl < T : std:: ops:: Deref < Target = str > > std:: cmp:: PartialEq < T > for SymbolStr {
1113
1115
fn eq ( & self , other : & T ) -> bool {
1114
1116
self . string == other. deref ( )
@@ -1118,6 +1120,11 @@ impl<T: std::ops::Deref<Target = str>> std::cmp::PartialEq<T> for SymbolStr {
1118
1120
impl !Send for SymbolStr { }
1119
1121
impl !Sync for SymbolStr { }
1120
1122
1123
+ /// This impl means that if `ss` is a `SymbolStr`:
1124
+ /// - `*ss` is a `str`;
1125
+ /// - `&*ss` is a `&str`;
1126
+ /// - `&ss as &str` is a `&str`, which means that `&ss` can be passed to a
1127
+ /// function expecting a `&str`.
1121
1128
impl std:: ops:: Deref for SymbolStr {
1122
1129
type Target = str ;
1123
1130
#[ inline]
You can’t perform that action at this time.
0 commit comments