有没有办法这样做:
let (a, b) in as.as_mut_iter().zip(&bs) { *a = b; }
js5cn81o1#
fn main() { let mut ass = vec![1, 2, 3]; let bs = vec![4, 5, 6]; for (a, b) in ass.iter_mut().zip(&bs) { *a = *b; } dbg!(ass); }
看起来工作正常https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=edad99b5cafa850203e93742057c2ac2
1条答案
按热度按时间js5cn81o1#
看起来工作正常https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=edad99b5cafa850203e93742057c2ac2