title: How do I declare the lifetime parameters for a type which contains a reference to a type with a lifetime parameter?
body: <p>Trying to figure out how to describe this lifetime relationship.</p>
  <p>So let's say I have a component which has a lifetime parameter:</p>
  <pre><code>struct Foo&lt;'a&gt; { ... }
  </code></pre>
  <p>And let's say I want to have another component which contains a reference to <code>Foo</code></p>
  <pre><code>struct Bar&lt;??&gt; {
      foo: &amp;'? Foo&lt;'?&gt;
  }
  </code></pre>
  <p>How do I express the following:</p>
  <ol>
  <li>The lifetime of the reference to <code>foo</code> should be the lifetime of the <code>Bar</code> containing it</li>
  <li>I don't care about the lifetime of the underlying <code>Foo</code>, so long as it's longer than the lifetime of the <code>Bar</code> containing the reference</li>
  </ol>
  <p><strong>edit</strong>: So if <code>Foo</code> itself didn't have a lifetime parameter, I would implement <code>Bar</code> like this:</p>
  <pre><code>struct Bar&lt;'a&gt; {
      foo: &amp;'a Foo
  }
  
  </code></pre>
  <p>But I don't know how to handle the parameter on <code>Foo</code>.</p>