Closed wrnrlr closed 1 year ago
I was wondering if it is possible and/or sensible to be able to create a component out of a closure or function. Something like this:
for (_id, (f)) in world.query::<(Box<dyn Fn()->Point>,)>() { //... }
This could be a nice way to program some dynamic behaviour without needing a hierarchy of systems and entities.
Any Rust type that satisfies Send + Sync may be used as a component. This includes boxed closures that include that constraint.
Send + Sync
I was wondering if it is possible and/or sensible to be able to create a component out of a closure or function. Something like this:
This could be a nice way to program some dynamic behaviour without needing a hierarchy of systems and entities.