You can use the izip!()
macro from the crate itertools, which implements this for arbitrary many iterators:
use itertools::izip;
fn main() {
let a = [1, 2, 3];
let b = [4, 5, 6];
let c = [7, 8, 9];
// izip!() accepts iterators and/or values with IntoIterator.
for (x, y, z) in izip!(&a, &b, &c) {
}
}
You would have to add a dependency on itertools in Cargo.toml, use whatever version is the latest. Example:
[dependencies]
itertools = "0.8"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…