Hello, thank you for sharing your knowledge. I’m learning rust, and I see that you were able to return string slices (which are references) from the make_value function. Why did it work without having to annotate lifetime parameters? Does “impl Display” puts them implicitly?
Hello, thank you for sharing your knowledge. I’m learning rust, and I see that you were able to return string slices (which are references) from the make_value function. Why did it work without having to annotate lifetime parameters? Does “impl Display” puts them implicitly?
I found this error message that explains things well:
github.com/rust-lang/rust/issues/5...
The lifetime is 'static by default, but writing
Display + '_
tells the compiler to infer a shorter-lasting lifetime.