📜  复制一个数组 - Rust 代码示例

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

代码示例3
// Copy an array
fn main() {
    let arr = ["a","b","c"];
    let mut another = arr.clone();  // make a copy
    println!("copy of arr = {:?} ", another);
    another[1] = "d";          // make a change
    assert_eq!(arr, another);  // panic, no longer equal
}