File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,27 @@ pub use std_unicode::str::SplitWhitespace;
59
59
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
60
60
pub use core:: str:: pattern;
61
61
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
+
62
83
#[ unstable( feature = "slice_concat_ext" ,
63
84
reason = "trait should not have to exist" ,
64
85
issue = "27747" ) ]
You can’t perform that action at this time.
0 commit comments