What is the meaning of 'a: 'a in rust lifetime parameters

'a:'b means that the lifetime of a is longer than that of b. I was thinking that it would be easier to understand if you use >=, such as 'a >='b.

1 Like

Oh yeah, apologies for not answering the actual question asked... lol.

'a: 'b is often read as "'a outlives 'b". Documentation in the reference.

Rust does have an unfortunate tendency to overload the single colon: for types and lifetimes (there's an analogy here but it's not immediately obvious), trait bounds, supertraits, and -- worst of all -- field initialization for structs/struct variants.

Indeed, a single colon is used in many places, and the meaning is different

"Everybody wants the colon" -- Larry Wall's first law of language design

3 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.