File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -1481,7 +1481,7 @@ s.push_str(", world.");
1481
1481
println!("{}", s);
1482
1482
```
1483
1483
1484
- You can coerce a ` String ` into a ` &str ` with the ` as_slice() ` method:
1484
+ You can get a ` &str ` view into a ` String ` with the ` as_slice() ` method:
1485
1485
1486
1486
``` {rust}
1487
1487
fn takes_slice(slice: &str) {
@@ -1514,7 +1514,7 @@ fn compare(string: String) {
1514
1514
}
1515
1515
```
1516
1516
1517
- Converting a ` String ` to a ` &str ` is cheap, but converting the ` &str ` to a
1517
+ Viewing a ` String ` as a ` &str ` is cheap, but converting the ` &str ` to a
1518
1518
` String ` involves allocating memory. No reason to do that unless you have to!
1519
1519
1520
1520
That's the basics of strings in Rust! They're probably a bit more complicated
You can’t perform that action at this time.
0 commit comments