Skip to content

Commit 6365272

Browse files
committed
Move str docs to proper place in file.
1 parent 67867c6 commit 6365272

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

src/libcollections/str.rs

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,27 @@
1010

1111
//! Unicode string slices.
1212
//!
13+
//! The `&str` type is one of the two main string types, the other being `String`. Unlike its `String` counterpart, its contents
14+
//! are borrowed and therefore cannot be moved someplace else.
15+
//!
16+
//! # Basic Usage
17+
//! A basic string declaration of `&str` type:
18+
//!
19+
//! ```
20+
//! let hello_world = "Hello, World!";
21+
//! ```
22+
//!
23+
//! Here we have declared a string literal, also known as a string slice.
24+
//! String literals have a static lifetime, which means the string `hello_world`
25+
//! is guaranteed to be valid for the duration of the entire program. We can explicitly specify
26+
//! `hello_world`'s lifetime as well:
27+
//!
28+
//! ```
29+
//! let hello_world:&'static str = "Hello, world!";
30+
//! ```
31+
//!
1332
//! *[See also the `str` primitive type](../../std/primitive.str.html).*
1433
15-
1634
#![stable(feature = "rust1", since = "1.0.0")]
1735

1836
// Many of the usings in this module are only used in the test configuration.
@@ -59,27 +77,6 @@ pub use std_unicode::str::SplitWhitespace;
5977
#[stable(feature = "rust1", since = "1.0.0")]
6078
pub use core::str::pattern;
6179

62-
/// Unicode string slices.
63-
///
64-
/// The `&str` type is one of the two main string types, the other being `String`. Unlike its `String` counterpart, its contents
65-
/// are borrowed and therefore cannot be moved someplace else.
66-
///
67-
/// # Basic Usage
68-
/// A basic string declaration of `&str` type:
69-
///
70-
/// ```
71-
/// let hello_world = "Hello, World!";
72-
/// ```
73-
/// Here we have declared a string literal, also known as a string slice.
74-
/// String literals have a static lifetime, which means the string `hello_world`
75-
/// is guaranteed to be valid for the duration of the entire program. We can explicitly specify
76-
/// `hello_world`'s lifetime as well:
77-
///
78-
/// ```
79-
/// let hello_world:&'static str = "Hello, world!";
80-
/// ```
81-
///
82-
8380
#[unstable(feature = "slice_concat_ext",
8481
reason = "trait should not have to exist",
8582
issue = "27747")]

0 commit comments

Comments
 (0)