Need Assistance?

support@tutorialshub.in

Generics, Traits & Lifetimes

Understanding Lifetimes ('a) Simply

ADVERTISEMENT
Rust Free Lesson
5 min read
ADVERTISEMENT

When a function takes two references and returns a reference, Rust needs to know which input the returned reference borrows from so it never outlives its source. A lifetime annotation like 'a simply connects the lifetimes of inputs and outputs.

ADVERTISEMENT
Hi, I'm Tuby! Here to help you