The Rust char
type is 32-bits in size.
From
Rust by Example: Strings
A String is stored as a vector of bytes (Vec(lt;u8>), but guaranteed to always be a valid UTF-8 sequence. String is heap allocated, growable and not null terminated. &str is a slice (&[u8]) that always points to a valid UTF-8 sequence, and can be used to view into a String, just like &[T] is a view into Vec<T>.
There are several crates on crates.io which offer Unicode normalization.
Rust strings have the function as_bytes()
which returns a
byte slice of the stringss contents.
An array of u8
(presumably of UTF-8 bytes) can be converted to a
string by str::from_utf8()
There are several crates on crates.io which offer conversion to IDN.
Copyright © Jan Newmarch, jan@newmarch.name
" Network Programming using Java, Go, Python, Rust, JavaScript and Julia"
by
Jan Newmarch
is licensed under a
Creative Commons Attribution-ShareAlike 4.0 International License
.
Based on a work at
https://jan.newmarch.name/NetworkProgramming/
.