mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-04-26 09:12:58 +02:00
Clarify String
definition (#2044)
Changed string definitions in string.md and strings.md files according to discussion #2028
This commit is contained in:
parent
b6343d0522
commit
40fce81e1c
@ -11,7 +11,7 @@ Including `&str` as a way of representing a slice of valid utf-8
|
|||||||
We can now understand the two string types in Rust:
|
We can now understand the two string types in Rust:
|
||||||
|
|
||||||
- `&str` is a slice of UTF-8 encoded bytes, similar to `&[u8]`.
|
- `&str` is a slice of UTF-8 encoded bytes, similar to `&[u8]`.
|
||||||
- `String` is an owned, heap-allocated buffer of UTF-8 bytes.
|
- `String` is an owned buffer of UTF-8 encoded bytes, similar to `Vec<T>`.
|
||||||
|
|
||||||
<!-- Avoid using fixed integers when slicing since this breaks
|
<!-- Avoid using fixed integers when slicing since this breaks
|
||||||
translations. Using the length of s1 and s2 is safe. -->
|
translations. Using the length of s1 and s2 is safe. -->
|
||||||
|
@ -4,7 +4,7 @@ minutes: 10
|
|||||||
|
|
||||||
# String
|
# String
|
||||||
|
|
||||||
[`String`][1] is the standard heap-allocated growable UTF-8 string buffer:
|
[`String`][1] is a growable UTF-8 encoded string:
|
||||||
|
|
||||||
```rust,editable
|
```rust,editable
|
||||||
fn main() {
|
fn main() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user