currently I have some code similar to the following:
// Lifetime of child is enforced to be valid as far as Parent is valid
struct Child<'a> {
some_data : i32,
phantom_lifetime: PhantomData<&'a Parent>
}
struct Parent {
}
#[wasm_bindgen]
pub struct Foo<'a> {
parent: Parent,
children: Vec<Child<'a>>
}
The problem now is I have to get rid of the lifetime of Foo
because wasm_bindgen
will not allow it.
Intuitively the lifetime should be enforced just by the creation of the struct Foo
. However the compiler asks me to provide the lifetime anyway.
Anyway I have no idea how to accomplish that. Can somebody help me?