Hello,
I don't know if this is already possible in Rust, but I had a little thought about lifetimes.
Why not add a specific lifetime 'parent , like 'static ?
I think it makes the developer's experience easier by making Rust less verbose.
I'll give you a few case studies :
struct TestA<'a> {
val: usize,
str: &'a str
}
fn main() {
let t = TestA{
val:10usize,
str:"Hello"
};
println!("T>val = {} || T>str = {}",t.val,t.str);
}
it would be easier that way :
struct TestA {
val: usize,
str: &'parent str
}
With 'parent we inform the compiler that we want str to have the same lifetime as its parent, i.e. TestA.
( 'parent lifetime takes maximum lifetime of Parent.)
What do you think?