diff options
| author | bors <bors@rust-lang.org> | 2014-04-10 21:01:41 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-04-10 21:01:41 -0700 |
| commit | cea8def62068b405495ecd1810124ebc88b4f90b (patch) | |
| tree | 65d5755bd532a9213799c52572db6d6683d5e942 /src/doc/tutorial.md | |
| parent | 0156af156d70efd5a3c96d0c5b8fc9bec39a7ae5 (diff) | |
| parent | def90f43e2df9968cda730a2a30cb7ccb9513002 (diff) | |
auto merge of #13440 : huonw/rust/strbuf, r=alexcrichton
libstd: Implement `StrBuf`, a new string buffer type like `Vec`, and port all code over to use it. Rebased & tests-fixed version of https://github.com/mozilla/rust/pull/13269
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'); ~~~ |
