I'm having trouble defining a function that returns a vector of Nodefrom the select crate, v0.2.2. I've been adding to this function as I've worked my way through error messages (aided by other questions online), but I can't figure out how to assign the 'a lifetime variable to the return value:
extern crate select;
use select::document::Document;
use select::predicate::*;
fn elems_by_class<'a, Node>(document: &'a Document, class: &str) ->   Vec<Node<>>
    where Vec<Node>: std::iter::FromIterator<select::node::Node<'a>>
{
    document.find(Attr("class", class)).iter().collect::<Vec<Node<>>>()
}
fn main() {}
The error I'm getting is
error: borrowed value does not live long enough
  --> src/main.rs:9:5
   |
9  |     document.find(Attr("class", class)).iter().collect::<Vec<Node<>>>()
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value created here
10 | }
   | - temporary value only lives until here
   |
note: borrowed value must be valid for the lifetime 'a as defined on the block at 8:0...
  --> src/main.rs:8:1
   |
8  | {
   | ^
How can I assign the 'a lifetime to the function call? I tried (unsuccessfully) using variables, but read that variables created within the function body might cause problems, so abandoned that approach. Have I dug myself too far down the borrow hole, and should this function be defined in a simpler way?