Replies: 1 comment
-
Will be useful in generic contexts, for example trait QueryDataFunction {
type Data: QueryData;
type Out;
fn run(data: Self::Data) -> Out;
}
/// System that runs B only if A returns true
fn run_if_true<
A: QueryDataFunction<Out = bool>,
B: QueryDataFunction<Out = ()>,
>(Query<DataSet<(A::Data, B::Data)>>) {
for mut set in query.iter_mut() {
if A::run(set.d0()) {
B::run(set.d1());
}
}
}
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Requesting the
QueryData
implementer that allows disjointed access. Similar toParamSet
, but forQueryData
.From this point I will call such implementer
DataSet
(similar to howParamSet
forSystemParam
was named)Allows querying this:
Query<DataSet<(&Transform, &mut Transform)>>
Possible implementation: Similar to the
ParamSet
implementation.Requires cloning
WorldQuery::Fetch
in call toWorldQuery::fetch
Requires adding method to the
WorldQuery
trait similar toWorldQuery::shrink
, but forWorldQuery::Fetch
as input and output so that it is possible to implementWorldQuery::shrink
I have made basic proof-of-concept implementation without proc macro just for 2 parameters in set: https://github.com/vil-mo/bevy_data_set
Beta Was this translation helpful? Give feedback.
All reactions