Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

:timing
:sccache 1

Character

Rust supports unicode characters. Notice that emojis are single unicode characters.

let c1 = 'a';
c1
'a'
let c2 = '\u{1f604}';
c2
'😄'

char::from_u32

'Z' as u32
90
char::from_u32(90)
Some('Z')
let c = char::from_u32(0x2764);
c
Some('❤')

char::from_digit

char::from_digit(9, 10)
Some('9')

char::to_uppercase

char::to_uppercase returns an interator instead of a char!

'a'.to_uppercase()
ToUppercase(One('A'))
'a'.to_uppercase().next()
Some('A')
'a'.to_uppercase().next().unwrap()
'A'