fn main() {
let (a,b):(i32,i32)=vec![33,44].iter().map(|&a| a+5).collect();
println!("{a} {b}");
}
fn main() {
let items = [1,2];
let mut iter = items.into_iter().map(|x|5+x);
let a = iter.next().unwrap();
let b = iter.next().unwrap();
println!("{a} {b}");
}
fn main() {
let items = [1,2];
let [a,b] = items.map(|x|5+x);
println!("{a} {b}");
}
use itertools::Itertools; // 0.9.0
fn main() {
let items = [1,2];
let (a,b) = items.iter().map(|x|5+x).next_tuple().unwrap();
println!("{a} {b}");
}