primitive-type
Rust u16: 16-bit unsigned integer
`u16` stores nonnegative whole numbers in 16 bits. Its range is 0 through 65,535. A numeric value in the range of TCP or UDP port numbers. Expected output: 8080 Why: The chosen value is representable by u16. Common mistake: Representability does not mean a port is available.
Formal Syntax & Structure
rust syntaxrust
let name: u16 = integer_literal;Working Example
Example Snippetrust
fn main() { let port: u16 = 8080; println!("{port}");}