Error code E0604
A cast to char
was attempted on a type other than u8
.
Erroneous code example:
ⓘ
char
is a Unicode Scalar Value, an integer value from 0 to 0xD7FF and
0xE000 to 0x10FFFF. (The gap is for surrogate pairs.) Only u8
always fits in
those ranges so only u8
may be cast to char
.
To allow larger values, use char::from_u32
, which checks the value is valid.
For more information about casts, take a look at the Type cast section in The Reference Book.