How to use lifetime in component definition? #1691
-
Suppose I have two structures A and B, A contains a tree Sample code: struct A(Tree);
struct B(Option<&'static Node>);
fn main() {
...
app.add_resource(A(tree));
app.add_resouece(B(None));
} |
Beta Was this translation helpful? Give feedback.
Answered by
TheRawMeatball
Mar 19, 2021
Replies: 1 comment
-
I don't think you can use lifetimes for this - all resources and components must be 'static. You should probably make a single 'static struct that wraps the, entire graph and put that in. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
lisiur
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't think you can use lifetimes for this - all resources and components must be 'static. You should probably make a single 'static struct that wraps the, entire graph and put that in.