Skip to content

Commit

Permalink
Update str::split_at_mut example to demonstrate mutability.
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Aug 5, 2017
1 parent ea6a657 commit de4f1a1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/liballoc/str.rs
Expand Up @@ -330,7 +330,7 @@ impl str {
/// ```
/// let mut v = String::from("🗻∈🌏");
///
/// assert_eq!(Some("🗻"), v.get(0..4);
/// assert_eq!(Some("🗻"), v.get(0..4));
///
/// // indices not on UTF-8 sequence boundaries
/// assert!(v.get_mut(1..).is_none());
Expand Down Expand Up @@ -573,12 +573,16 @@ impl str {
/// Basic usage:
///
/// ```
/// let mut s = "Per Martin-Löf".to_string();
///
/// let (first, last) = s.split_at_mut(3);
/// use std::ascii::AsciiExt;
///
/// assert_eq!("Per", first);
/// assert_eq!(" Martin-Löf", last);
/// let mut s = "Per Martin-Löf".to_string();
/// {
/// let (first, last) = s.split_at_mut(3);
/// first.make_ascii_uppercase();
/// assert_eq!("PER", first);
/// assert_eq!(" Martin-Löf", last);
/// }
/// assert_eq!("PER Martin-Löf", s);
/// ```
#[inline]
#[stable(feature = "str_split_at", since = "1.4.0")]
Expand Down

0 comments on commit de4f1a1

Please sign in to comment.