Lifetime for Option<struct> field


#1

I understand the error, but I do not know how to use lifetimes to correct it.

Struct T may or may not own a S. The S uses life times for its reference field, so T needs it too. That is correct? Is it possible?

struct S<'a> {
    e:&'a usize,
}
struct T {
    o:Option<S>,
}
fn main() {
}
error[E0106]: missing lifetime specifier
 --> src/main.rs:5:14
  |
5 |     o:Option<S>,
  |              ^ expected lifetime parameter

#2
struct T<'a> {
    o:Option<S<'a>>,
}