0

I'm looking at the source for clap's Parser which has the following declaration:

pub struct Parser<'a, 'b>
where
    'a: 'b,
{
   ...
}

What do the lifetime specifiers mean here? I understand that specifying a single lifetime parameter indicates that member references annotated with that lifetime parameter means that an instance of that struct can't outlive the lifetime of that member.

How is this declaration different?

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
jwir3
  • 6,019
  • 5
  • 47
  • 92
  • This syntax requires that the lifetime `'a` outlives `'b`. See also [the relevant chapter in the book](https://doc.rust-lang.org/book/2018-edition/ch19-02-advanced-lifetimes.html#ensuring-one-lifetime-outlives-another-with-lifetime-subtyping). – Sven Marnach Nov 09 '18 at 15:58
  • I believe your question is answered by the answers of [When is it useful to define multiple lifetimes in a struct?](https://stackoverflow.com/q/29861388/155423). If you disagree, please [edit] your question to explain the differences. Otherwise, we can mark this question as already answered. – Shepmaster Nov 09 '18 at 15:59
  • See also [Does <'a, 'b: 'a> mean that the lifetime 'b must outlive the lifetime 'a?](https://stackoverflow.com/q/30768063/155423) – Shepmaster Nov 09 '18 at 16:01

0 Answers0