Going through rustlings for the first time
1// Lifetimes are also needed when structs hold references.
2
3// TODO: Fix the compiler errors about the struct.
4struct Book<'a> {
5 author: &'a str,
6 title: &'a str,
7}
8
9fn main() {
10 let book = Book {
11 author: "George Orwell",
12 title: "1984",
13 };
14
15 println!("{} by {}", book.title, book.author);
16}