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
11091109 }
11101110}
11111111
1112+ // This impl allows a `SymbolStr` to be directly equated with a `String` or
1113+ // `&str`.
11121114impl < T : std:: ops:: Deref < Target = str > > std:: cmp:: PartialEq < T > for SymbolStr {
11131115 fn eq ( & self , other : & T ) -> bool {
11141116 self . string == other. deref ( )
@@ -1118,6 +1120,11 @@ impl<T: std::ops::Deref<Target = str>> std::cmp::PartialEq<T> for SymbolStr {
11181120impl !Send for SymbolStr { }
11191121impl !Sync for SymbolStr { }
11201122
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`.
11211128impl std:: ops:: Deref for SymbolStr {
11221129 type Target = str ;
11231130 #[ inline]
You can’t perform that action at this time.
0 commit comments