struct Book {
title: String,
author: String,
pages: u32,
}
fn main() {
let books = vec![
Book {
title: "The Rust Programming Language".to_string(),
author: "Steve Klabnik and Carol Nichols".to_string(),
pages: 400,
},
Book {
title: "Effective Rust".to_string(),
author: "Joshua Nelson".to_string(),
pages: 200,
},
Book {
title: "Learning Rust with Entirely Too Many Linked Lists".to_string(),
author: "Nicolai M. Josuttis".to_string(),
pages: 50,
},
];
let new_books = books.into_iter()
.filter(|book| book.pages > 100)
.map(|book| (book.title.len(), book.author.len()))
.collect::<Vec<_>>();
println!("{:?}", new_books);
}