Skip to content

Commit

Permalink
renaming is hard
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelraz committed Oct 23, 2023
1 parent eab19e2 commit b97efc1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions training-slides/src/shared-mutability.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ fn main() {
..Post::default()
};
assert!(post.first_viewed_at.get().is_none());
println!("{:?}", post.hn_ranking());
println!("{:?}", post.date_of_first_view());
assert!(post.first_viewed_at.get().is_some());
}

Expand All @@ -300,7 +300,7 @@ struct Post {
}

impl Post {
fn hn_ranking(&self) -> Instant {
fn date_of_first_view(&self) -> Instant {
*self.first_viewed_at.get_or_init(|| {Instant::now()})
}
}
Expand Down

0 comments on commit b97efc1

Please sign in to comment.