📜  初始化数组 rust 代码示例

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

代码示例1
let _: [u8; 3] = [1, 2, 3];
let _: [&str; 3] = ["1", "2", "3"];

let _: [String; 3] = [
    String::from("1"),
    String::from("2"),
    String::from("3")
];

let mut rng = rand::thread_rng();
let _: [u8; 3] = [rng.gen(), rng.gen(), rng.gen()];