]> git.proxmox.com Git - rustc.git/blob - src/doc/book/listings/ch10-generic-types-traits-and-lifetimes/listing-10-25/src/main.rs
New upstream version 1.43.0+dfsg1
[rustc.git] / src / doc / book / listings / ch10-generic-types-traits-and-lifetimes / listing-10-25 / src / main.rs
1 struct ImportantExcerpt<'a> {
2 part: &'a str,
3 }
4
5 fn main() {
6 let novel = String::from("Call me Ishmael. Some years ago...");
7 let first_sentence = novel.split('.').next().expect("Could not find a '.'");
8 let i = ImportantExcerpt {
9 part: first_sentence,
10 };
11 }