We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents d1ac69c + ce223a6 commit c7d5354Copy full SHA for c7d5354
src/doc/trpl/more-strings.md
@@ -278,7 +278,18 @@ This will print:
278
279
Many more bytes than graphemes!
280
281
-# Other Documentation
+# `Deref` coercions
282
283
-* [the `&str` API documentation](../std/str/index.html)
284
-* [the `String` API documentation](../std/string/index.html)
+References to `String`s will automatically coerce into `&str`s. Like this:
+
285
+```
286
+fn hello(s: &str) {
287
+ println!("Hello, {}!", s);
288
+}
289
290
+let slice = "Steve";
291
+let string = "Steve".to_string();
292
293
+hello(slice);
294
+hello(&string);
295
0 commit comments