amethyst / shred

Shared resource dispatcher
Apache License 2.0
233 stars 66 forks source link

Lifetime Parameters #233

Closed matt328 closed 7 months ago

matt328 commented 8 months ago

It's probably just because I'm new to rust, but how do I make a Dispatcher a member of a struct without having to bubble lifetime parameters through my entire object hierarchy?

Imberflur commented 8 months ago

I think you should be able to set the lifetime parameters to 'static as long as all your systems are 'static (i.e. none of your system types contain lifetime parameters themselves).

matt328 commented 7 months ago

This is what I ended up doing. It felt kinda of wrong, but these things should live for the entire lifetime of the program, and I think that's basically the definition of 'static.