Challenge 2: FirstLine and Elision Rule 3 — Possible Solution ==================================================================== struct FirstLine<'a> { line: &'a str, } impl<'a> FirstLine<'a> { fn announce(&self) -> &str { self.line } } fn main() { let text = String::from("Hello\nWorld"); let first = FirstLine { line: text.lines().next().unwrap() }; println!("{}", first.announce()); } WHY THIS WORKS AS AN ANSWER ------------------------------ The struct itself, FirstLine<'a> { line: &'a str }, needs an explicit lifetime parameter because it HOLDS a reference — exactly this chapter's struct-lifetime rule: the struct instance's own validity is tied to how long the referenced string data (here, a slice of `text`) remains valid. announce, however, needs NO explicit lifetime annotation of its own, despite returning a reference — this is elision RULE 3 specifically: because announce takes &self as a parameter, the compiler automatically assigns self's lifetime to the returned reference. Since self is a &FirstLine<'a>, and FirstLine<'a> already carries the 'a lifetime that line was defined with, the compiler can mechanically work out that the returned &str shares that same 'a — without the method needing to spell out &'a self -> &'a str explicitly. This is precisely the situation this chapter names as the explanation for why Course 1's own &self methods (like Chapter 5's area()) never needed lifetime annotations even when they returned references: rule 3 was quietly doing the work in every one of those cases too.