primitive-type

Rust char: a Unicode scalar value

A char represents one Unicode scalar value and occupies four bytes. It can store a Persian letter, an ASCII letter or many individual emoji, but not every multi-code-point grapheme cluster. Expected output: س Why: The character literal represents the Unicode scalar value for the Persian letter sin. Common mistake: Use single quotes for char; double quotes create a string literal.

Formal Syntax & Structure

rust syntaxrust
let name: char = 'x';

Working Example

Example Snippetrust
fn main() {    let letter: char = 'س';    println!("{letter}");}
Rust Reference