Add `System::dispose`
torkleyy opened this issue · comments
Requested by @Frizi.
System::dispose
would be called by Dispatcher::dispose
and can be used to clean up externally allocated resources.
Unresolved
- Signature:
fn dispose(&self, world: &World)
/fn dispose(&self, world: &mut World)
/fn dispose(&mut self, world: &World)
/fn dispose(&mut self, world: &mut World)
- Is it mandatory to call it? How to make sure it gets called?
@torkleyy curious what is the difference between this and drop?
It has access to World
, which is required for access to rendy::Factory
in this case.
@torkleyy that makes sense, I would imagine in that case a fn dispose(&mut self, world: &mut World)
might make sense here.
Yeah, I think that makes sense.
Now, how do we make sure it gets called?
One option would be to set a flag when it gets called, and check it is set in Dispatcher::drop
.