Hi,
I ran into a clippy remark I never saw before and could not find a explaination.
I wanted to write a function using a trait bound on Deserialize
for serde.
Apparently a lifetime is required as well. Ok. I learned about lifetime parameters in the Book.
But I go a suggestion "bound lifetime-generic" with a for<'a>
... I never saw this in the Book.
Here below are the 2 option clippy will fix my function.
\\ Bound lifetime-generic.
fn decode<T: for<'a> Deserialize<'a>>(&self, data: Bytes) -> T
\\ Named lifetime parameter.
fn decode<'a, T: Deserialize<'a>>(&self, data: Bytes) -> T
Can someone has an explaination on the difference between the two form and what it imply ?
Also, where is learning material that talks about this ?