//@ check-pass struct LoadedObject { bodies: Vec, color: Color, } struct Body; #[derive(Clone)] struct Color; struct Graphic { color: Color, } fn convert(objects: Vec) -> (Vec, Vec) { objects .into_iter() .flat_map(|LoadedObject { bodies, color, .. }| { bodies.into_iter().map(move |body| { ( body, Graphic { color: color.clone(), }, ) }) }) .unzip() } fn main() {}