10837 shaares
386 private links
386 private links
Lifetime annotations are needed to tell the compiler that we are manipulating some kind of long-lived reference and let it assert that we are not going to screw ourselves
The only downside is that smart pointers, in Rust, are a little bit verbose (but still way less ugly than lifetime annotations). [They add some runtime overhead.]
When to use lifetimes annotations?
When performance really matters or when your code will be used in no_std environments.