pub fn reverse_grapheme_clusters_in_place(s: &mut str)
Expand description

Reverse a Unicode string in-place without allocating.

This function reverses a string slice in-place without allocating any memory on the heap. It correctly handles multi-byte UTF-8 sequences and grapheme clusters, including combining marks and astral characters such as Emoji.

See the crate-level documentation for more details.

§Example

extern crate unicode_reverse;
use unicode_reverse::reverse_grapheme_clusters_in_place;

fn main() {
    let mut x = "man\u{0303}ana".to_string();
    println!("{}", x); // prints "mañana"

    reverse_grapheme_clusters_in_place(&mut x);
    println!("{}", x); // prints "anañam"
}