Rollup merge of #44449 - tommyip:doc_string_as_str, r=frewsxcv
Add doc example to String::as_str Fixes #44428.
This commit is contained in:
commit
d3ef39f2af
@ -743,6 +743,16 @@ impl String {
|
||||
}
|
||||
|
||||
/// Extracts a string slice containing the entire string.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
///
|
||||
/// ```
|
||||
/// let s = String::from("foo");
|
||||
///
|
||||
/// assert_eq!("foo", s.as_str());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "string_as_str", since = "1.7.0")]
|
||||
pub fn as_str(&self) -> &str {
|
||||
|
Loading…
Reference in New Issue
Block a user