Compare commits

..

No commits in common. "fc13310be84f2c676c344cd64a361a44474a59d2" and "a754093bd02ec5e5ab8731071bead12379cfdc5a" have entirely different histories.

2 changed files with 1 additions and 16 deletions

View File

@ -1,11 +0,0 @@
# Small project to somewhat better understand lifetimes.
This small project aims to help understanding how lifetimes work in rust a little better.
Swap branches to see difference without specifying lifetimes, with lifetimes and then a simplified version.
# youtube
Heavily inspired by the following video: https://www.youtube.com/watch?v=gRAVZv7V91Q

View File

@ -6,11 +6,7 @@ fn main() {
println!("The longest string is {result}"); println!("The longest string is {result}");
} }
fn longest<'a, 'b, 'out>(a: &'a str, b: &'b str) -> &'out str fn longest(a: &str, b: &str) -> &str {
where
'a: 'out,
'b: 'out,
{
if a.len() > b.len() { if a.len() > b.len() {
a a
} else { } else {