Skip to content

Commit

Permalink
Add doc example to String::as_mut_str
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyip committed Sep 10, 2017
1 parent dee6d0f commit bc1a4c6
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 @@ -749,7 +749,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 bc1a4c6

Please sign in to comment.