Byte literal in Table 3-2

screen
Screenshot of last row from Table 3-2 - Data Types - The Rust Programming Language
Where i can read about meanings of these columns ? Why parentheses include " u8 only" ? What does mean " b'A' " ?

b'A' is a byte, same as 65u8 (because the ascii value of "A" is 65). I think it specifies u8 only because byte could also mean i8. Similarly you can do b"some ascii string" to get a byte array (&[u8; _]).

Because while you can do:

let w: u8 = 65;
let x: u16 = 65;
let y: u8 = b'A';

You cannot do:

let z: u16 = b'A';
1 Like