Closed cjhowedev closed 9 months ago
After some thought, this is externally implementable. Nevermind
This has come up a few times before. The tricky part is that you might reasonably want either shared or unique references for each component of a bundle, so a clean general-purpose solution becomes complex. You could bodge something ugly but serviceable pretty easy with a declarative macro though, yeah.
If your goal is actually just to do some assert
s like that, you might be interested in https://github.com/Ralith/hecs/pull/354.
Allow for issuing queries using DynamicBundle. We currently have to use a separate struct with
#[derive(Query)]
. It would be nice if we could query a bundle, for example:Presumably,
MyBundleQuery
is generated by the#[derive(BundleQuery)]
. This is necessary because each field needs to be wrapped in a reference to work as a query type, so we can't use the originalMyBundle
.