Rust 튜토리얼 목차

Basic Type Conversion

Rust는 숫자 변수 타입에 대해 알고 있어야하며, u8u32로 쉽게 사용할 수 없습니다.

다행히 Rust는 as 키워드를 사용하여 숫자형을 쉽게 변환할 수 있습니다.

또는 parse를 자주 사용합니다.

let my_string = "42";
let my_integer = my_string.parse::<i32>().unwrap();
// double colon op, ::<i32> syntax tells the compiler to parse the string as an i32 type