diff options
| author | mdinger <mdinger.bugzilla@gmail.com> | 2014-11-08 00:46:11 -0500 |
|---|---|---|
| committer | mdinger <mdinger.bugzilla@gmail.com> | 2014-11-08 00:46:11 -0500 |
| commit | c39e9f3437bae430af39b1843aacf5399b8a4758 (patch) | |
| tree | 76bd5c1ddea602934abebead28b61350f34eb6a3 | |
| parent | c437fcf3e53cd44fb07e0687c883441cd5c52d6a (diff) | |
| download | rust-c39e9f3437bae430af39b1843aacf5399b8a4758.tar.gz rust-c39e9f3437bae430af39b1843aacf5399b8a4758.zip | |
Reword &str coercion into viewing
| -rw-r--r-- | src/doc/guide.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/doc/guide.md b/src/doc/guide.md index 2a74180393c..87816134378 100644 --- a/src/doc/guide.md +++ b/src/doc/guide.md @@ -1481,7 +1481,7 @@ s.push_str(", world."); println!("{}", s); ``` -You can coerce a `String` into a `&str` with the `as_slice()` method: +You can get a `&str` view into a `String` with the `as_slice()` method: ```{rust} fn takes_slice(slice: &str) { @@ -1514,7 +1514,7 @@ fn compare(string: String) { } ``` -Converting a `String` to a `&str` is cheap, but converting the `&str` to a +Viewing a `String` as a `&str` is cheap, but converting the `&str` to a `String` involves allocating memory. No reason to do that unless you have to! That's the basics of strings in Rust! They're probably a bit more complicated |
