📜  将字符串转换为 i32 rust 代码示例

📅  最后修改于: 2022-03-11 14:49:25.880000             🧑  作者: Mango

代码示例1
let my_u8: u8 = "42".parse::().unwrap();
let my_u32: u32 = "42".parse::().unwrap();

// or, to be safe, match the `Err`
match "foobar".parse::() {
  Ok(n) => do_something_with(n),
  Err(e) => weep_and_moan(),
}