Rust’s `as` operator explicitly converts a value to another type. Write the value, followed by `as` and the desired type: `100 as u8` converts the integer to a `u8`. section 1.3
Not every direct conversion is allowed. A number inferred as `i32` cannot be cast directly to `char`; the compiler reports that only `u8` can be cast to `char`. You can cast to `u8` first, then to `char`: section 1.3
fn main() {
let my_number = 100;
println!("{}", my_number as u8 as char);
}
The two casts convert 100 first to `u8`, then to `char`. section 1.3
Alternatively, declare the number as `u8` from the start and cast it directly to `char`. Check the value before converting to `u8`: its maximum is 255, so larger values cannot be represented unchanged. section 1.3



