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
GuillaumeGomez authored Sep 13, 2017
2 parents 7d1053b + bc1a4c6 commit de562c6
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 de562c6

Please sign in to comment.