char_slice_mut

Function char_slice_mut 

Source
pub fn char_slice_mut<R: RangeBounds<usize>>(
    s: &mut str,
    range: R,
) -> Option<&mut str>
Expand description

Slice a mutable str in units of UTF-8 characters.

use mut_str::char_slice_mut;

let mut owned_s = Box::<str>::from("Hello, World!");

let hello = char_slice_mut(&mut *owned_s, ..5).unwrap();
assert_eq!(hello, "Hello");

let world = char_slice_mut(&mut *owned_s, 7..12).unwrap();
assert_eq!(world, "World");