diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-09-05 11:06:08 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-09-05 11:07:06 -0700 |
| commit | 1c9c32782d7dddadfbb9dd9dd149b33e28308439 (patch) | |
| tree | fe7751d6d727ddd77eb85d9b966a3b3db5172e71 | |
| parent | 69b363e02a29184641789598877409844736a7a1 (diff) | |
tutorial: Remove the section on strings
It's already covered in the types section.
| -rw-r--r-- | doc/tutorial.md | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/doc/tutorial.md b/doc/tutorial.md index 11a857cfd1b..3962b175405 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -1214,32 +1214,6 @@ let your_crayons = ~[banana_mania, beaver, bittersweet]; my_crayons += your_crayons; ~~~~ -## Strings - -The `~str` type in Rust is represented exactly the same way as a unique -vector of immutable bytes (`~[u8]`). This sequence of bytes is -interpreted as an UTF-8 encoded sequence of characters. This has the -advantage that UTF-8 encoded I/O (which should really be the default -for modern systems) is very fast, and that strings have, for most -intents and purposes, a nicely compact representation. It has the -disadvantage that you only get constant-time access by byte, not by -character. - -~~~~ -let huh = ~"what?"; -let que: u8 = huh[4]; // indexing a string returns a `u8` -assert que == '?' as u8; -~~~~ - -A lot of algorithms don't need constant-time indexed access (they -iterate over all characters, which `str::chars` helps with), and -for those that do, many don't need actual characters, and can operate -on bytes. For algorithms that do really need to index by character, -there are core library functions available. - -> ***Note:*** like vectors, strings will soon be allocatable in -> the local heap and on the stack, in addition to the exchange heap. - ## Vector and string methods Both vectors and strings support a number of useful |
