Hello everyone,
I'm new to Rust and am rather fond of the language for the most part.
However, one of the stumbling blocks I have encountered, are lifetimes in structs.
The concept of lifetimes makes sense to me and I (think) I can reason about them in my program as long as they are only used in functions.
But, having a struct with lifetimes causes a lot of headaches and after hours of failing to make the borrow checker happy, I've decided to look for a different approach.
I've read in multiple threads in this forum that structs with lifetimes are generally considered a bad idea/beginner mistake/anti-pattern.
I have studied the Smart Pointers chapters in the Rust book, but am looking for resources that help me develop a deeper understanding of Rust's ownership model and how to approach designing my data structures. I don't want to just naively replace all my &'a
s with Rc<...>
s without a more fundamental understanding of the language and how to use it.
Can anyone recommend some books (hard or soft copy), articles, video lectures or even code repos on the topic?
Thank you for your time