Skip to content

Commit

Permalink
Rollup merge of rust-lang#44453 - tommyip:doc_string_as_mut_str, r=fr…
Browse files Browse the repository at this point in the history
…ewsxcv

Add doc example to String::as_mut_str

Fixes rust-lang#44429.
  • Loading branch information
frewsxcv authored Sep 14, 2017
2 parents e67f434 + bc1a4c6 commit 423120a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/liballoc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,22 @@ impl String {
self
}

/// Extracts a string slice containing the entire string.
/// Converts a `String` into a mutable string slice.
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::ascii::AsciiExt;
///
/// let mut s = String::from("foobar");
/// let s_mut_str = s.as_mut_str();
///
/// s_mut_str.make_ascii_uppercase();
///
/// assert_eq!("FOOBAR", s_mut_str);
/// ```
#[inline]
#[stable(feature = "string_as_str", since = "1.7.0")]
pub fn as_mut_str(&mut self) -> &mut str {
Expand Down

0 comments on commit 423120a

Please sign in to comment.