rustlings

solving rustlings ft. dracuxan
git clone [email protected]:dracuxan/rustlings.git
Log | Files | Refs

README.md (998B)


      1 # Lifetimes
      2 
      3 Lifetimes tell the compiler how to check whether references live long
      4 enough to be valid in any given situation. For example lifetimes say
      5 "make sure parameter 'a' lives as long as parameter 'b' so that the return
      6 value is valid".
      7 
      8 They are only necessary on borrows, i.e. references,
      9 since copied parameters or moves are owned in their scope and cannot
     10 be referenced outside. Lifetimes mean that calling code of e.g. functions
     11 can be checked to make sure their arguments are valid. Lifetimes are
     12 restrictive of their callers.
     13 
     14 If you'd like to learn more about lifetime annotations, the
     15 [lifetimekata](https://tfpk.github.io/lifetimekata/) project
     16 has a similar style of exercises to Rustlings, but is all about
     17 learning to write lifetime annotations.
     18 
     19 ## Further information
     20 
     21 - [Lifetimes (in Rust By Example)](https://doc.rust-lang.org/stable/rust-by-example/scope/lifetime.html)
     22 - [Validating References with Lifetimes](https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html)