Ch. 17.3 - Listing 17-18 - why does content() have the 2nd param?

Listing 17-18

struct Published {}

impl State for Published {
    // --snip--
    fn content<'a>(&self, post: &'a Post) -> &'a str {
  • Why is Published an empty struct, vs having a content-like property (let's say data) to store the final content?
  • Follow-up: Why does content() now have a post parameter? I get it has to do with Published being empty, and I understand the lifetime additions, but I do not see anywhere in the full code body where content is being called with a parameter. Why would I not reference a from the content method?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.