std-method

String::push

Append one Unicode scalar value, encoded as UTF-8. Its byte width depends on the scalar. Expected stdout (not executed): Aش 3 Common mistake: Passing a double-quoted string to push.

Formal Syntax & Structure

rust syntaxrust
fn push(&mut self, ch: char)

Working Example

Example Snippetrust
fn main() {    let mut label = String::from("A");    label.push('ش');    println!("{label} {}", label.len());}
Rust Reference