Reference to element in vector
<p>I'm having trouble giving a struct a member variable that is a reference to another type. Here is my struct and implementation:</p>

<pre><code>struct Player&lt;'a&gt; {
    current_cell: &amp;'a Cell,
}

impl&lt;'a&gt; Player&lt;'a&gt; {
    pub fn new(starting_cell: &amp;'a Cell) -&gt; Player&lt;'a&gt; {
        Player { current_cell: starting_cell }
    }
}
</code></pre>

<p>The player has a reference to the current <code>Cell</code> that they are in. Here is my <code>Game</code> struct and its implementation:</p>

<pre><code>struct Game {
    is_running: bool,
    cells: Vec&lt;Cell&gt;,
}

impl Game {
    pub fn new() -&gt; Game {
        let cells = construct_cells();
        let player = Player::new(cells[0]);

        Game {
            is_running: false,
            cells: cells,
        }
    }
}
</code></pre>

<p><code>cells</code> is a vector of <code>Cell</code>s. When I create the game, I create a vector of cells in <code>construct_cells()</code> and then I start the player at the first cell. The error I am getting is: </p>

<pre class="lang-none prettyprint-override"><code>expected &amp;Cell, found struct `Cell`
</code></pre>

<p>I can see that I'm not passing a reference when I create the <code>Player</code>, but if I change the parameter to <code>&amp;cells[0]</code> then it yells at me for borrowing the entire vector and then trying to use it again when I create the <code>Game</code> struct. So what's going on? How do I just give the player a reference to a <code>Cell</code>?</p>