Skip to content

Instantly share code, notes, and snippets.

@Gisleburt
Last active June 10, 2019 12:28
Show Gist options
  • Save Gisleburt/0f6875506f2b71c813def79024090e83 to your computer and use it in GitHub Desktop.
Save Gisleburt/0f6875506f2b71c813def79024090e83 to your computer and use it in GitHub Desktop.
fn main() {
let daniel = User {
name: "Daniel".into(),
albums: Albums(vec![
Album {
title: "Sgt. Pepper's Lonely Hearts Club Band".into(),
artist: "The Beatles".into(),
},
Album {
title: "Dark Side of the Moon".into(),
artist: "Pink Floyd".into(),
},
]),
};
println!("{}'s albums:", daniel.name);
println!("{}", daniel.albums);
daniel
.albums
.iter()
.for_each(|album| println!("{}", album.title.to_uppercase()))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment