diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-04-02 16:54:22 -0700 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2014-04-10 22:10:10 +1000 |
| commit | d8e45ea7c054b4ad6fb82ec3a9fcf1736b4d7260 (patch) | |
| tree | 3ff220512aeae37710c8b1c783e1229e685bfce3 /src/doc/tutorial.md | |
| parent | 7fbcb400f0697621ece9f9773b0f0bf1ec73e9c1 (diff) | |
| download | rust-d8e45ea7c054b4ad6fb82ec3a9fcf1736b4d7260.tar.gz rust-d8e45ea7c054b4ad6fb82ec3a9fcf1736b4d7260.zip | |
libstd: Implement `StrBuf`, a new string buffer type like `Vec`, and
port all code over to use it.
Diffstat (limited to 'src/doc/tutorial.md')
| -rw-r--r-- | src/doc/tutorial.md | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md index d0463ca17d3..a0a012ef69b 100644 --- a/src/doc/tutorial.md +++ b/src/doc/tutorial.md @@ -1579,6 +1579,8 @@ allocated memory on the heap. A unique vector owns the elements it contains, so the elements are mutable if the vector is mutable. ~~~ +use std::strbuf::StrBuf; + // A dynamically sized vector (unique vector) let mut numbers = ~[1, 2, 3]; numbers.push(4); @@ -1589,7 +1591,7 @@ let more_numbers: ~[int] = numbers; // The original `numbers` value can no longer be used, due to move semantics. -let mut string = ~"fo"; +let mut string = StrBuf::from_str("fo"); string.push_char('o'); ~~~ |
