You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently Resources must be 'static, which makes it difficult to implement many functionalities as systems, notably rendering, since the textures / sprites / render contexts etc. usually have a lifetime associated with them.
My question is, is it possible to have resources that are generic over a lifetime parameter 'a and have Schedule::execute<'a>(&mut self, world: &mut World, resources: &'a mut Resource<'a>? After all, resources are not accessed outside of this function. Or is there some reason against this?
The text was updated successfully, but these errors were encountered:
I guess it has to do with rust's requirements on the Any trait. For those who encountered the same problem: std::mem::transmute can be used to circumvent this, but is "the most horribly unsafe thing you can do in Rust" according to the nomicon. Use at your own risk.
Currently
Resource
s must be'static
, which makes it difficult to implement many functionalities as systems, notably rendering, since the textures / sprites / render contexts etc. usually have a lifetime associated with them.My question is, is it possible to have resources that are generic over a lifetime parameter
'a
and haveSchedule::execute<'a>(&mut self, world: &mut World, resources: &'a mut Resource<'a>
? After all, resources are not accessed outside of this function. Or is there some reason against this?The text was updated successfully, but these errors were encountered: