|
10 | 10 | //
|
11 | 11 | // ignore-lexer-test FIXME #15679
|
12 | 12 |
|
13 |
| -//! Unicode string manipulation (the [`str`](../primitive.str.html) type). |
| 13 | +//! Unicode string manipulation (the `str` type). |
14 | 14 | //!
|
15 |
| -//! Rust's [`str`](../primitive.str.html) type is one of the core primitive |
16 |
| -//! types of the language. `&str` is the borrowed string type. This type of |
17 |
| -//! string can only be created from other strings, unless it is a `&'static str` |
18 |
| -//! (see below). It is not possible to move out of borrowed strings because they |
19 |
| -//! are owned elsewhere. |
| 15 | +//! Rust's `str` type is one of the core primitive types of the language. `&str` is the borrowed |
| 16 | +//! string type. This type of string can only be created from other strings, unless it is a |
| 17 | +//! `&'static str` (see below). It is not possible to move out of borrowed strings because they are |
| 18 | +//! owned elsewhere. |
20 | 19 | //!
|
21 | 20 | //! # Examples
|
22 | 21 | //!
|
|
26 | 25 | //! let s = "Hello, world.";
|
27 | 26 | //! ```
|
28 | 27 | //!
|
29 |
| -//! This `&str` is a `&'static str`, which is the type of string literals. |
30 |
| -//! They're `'static` because literals are available for the entire lifetime of |
31 |
| -//! the program. |
| 28 | +//! This `&str` is a `&'static str`, which is the type of string literals. They're `'static` |
| 29 | +//! because literals are available for the entire lifetime of the program. |
32 | 30 | //!
|
33 | 31 | //! You can get a non-`'static` `&str` by taking a slice of a `String`:
|
34 | 32 | //!
|
|
39 | 37 | //!
|
40 | 38 | //! # Representation
|
41 | 39 | //!
|
42 |
| -//! Rust's string type, `str`, is a sequence of Unicode scalar values encoded as |
43 |
| -//! a stream of UTF-8 bytes. All [strings](../../reference.html#literals) are |
44 |
| -//! guaranteed to be validly encoded UTF-8 sequences. Additionally, strings are |
45 |
| -//! not null-terminated and can thus contain null bytes. |
| 40 | +//! Rust's string type, `str`, is a sequence of Unicode scalar values encoded as a stream of UTF-8 |
| 41 | +//! bytes. All [strings](../../reference.html#literals) are guaranteed to be validly encoded UTF-8 |
| 42 | +//! sequences. Additionally, strings are not null-terminated and can thus contain null bytes. |
46 | 43 | //!
|
47 |
| -//! The actual representation of `str`s have direct mappings to slices: `&str` |
48 |
| -//! is the same as `&[u8]`. |
| 44 | +//! The actual representation of `str`s have direct mappings to slices: `&str` is the same as |
| 45 | +//! `&[u8]`. |
49 | 46 |
|
50 | 47 | #![doc(primitive = "str")]
|
51 | 48 | #![stable(feature = "rust1", since = "1.0.0")]
|
|
0 commit comments