I have the following method which borrows data with a lifetime 'a
and returning a future also supposed to live that long because I am using the function and awaiting on it to finish on the same scope as the actual variables I am referencing. (I am pretty new to the concept of borrowing in this level I hope I could express myself)
pub trait Store<'a> {
fn new_game(
&self,
name: &'a str,
creator_id: &'a str,
data_supplier_id: &'a str,
data_supplier_pass: &'a str,
video_addr: &'a Option<String>,
auto: bool,
cards: &'a Option<Card>,
) -> Pin<Box<dyn Future<Output = Result<i32>> + 'a>>;
First of all it feels like I am doing something wrong and second question is that unless I do something wrong is there a nicer way of defining those lifetimes without writing 'a
all over the place?