mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
34 lines
595 B
Rust
34 lines
595 B
Rust
//@ check-pass
|
|
|
|
struct LoadedObject {
|
|
bodies: Vec<Body>,
|
|
color: Color,
|
|
}
|
|
|
|
struct Body;
|
|
|
|
#[derive(Clone)]
|
|
struct Color;
|
|
|
|
struct Graphic {
|
|
color: Color,
|
|
}
|
|
|
|
fn convert(objects: Vec<LoadedObject>) -> (Vec<Body>, Vec<Graphic>) {
|
|
objects
|
|
.into_iter()
|
|
.flat_map(|LoadedObject { bodies, color, .. }| {
|
|
bodies.into_iter().map(move |body| {
|
|
(
|
|
body,
|
|
Graphic {
|
|
color: color.clone(),
|
|
},
|
|
)
|
|
})
|
|
})
|
|
.unzip()
|
|
}
|
|
|
|
fn main() {}
|