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
QueryDataimplementer that allows disjointed access. Similar toParamSet, but forQueryData.From this point I will call such implementer
DataSet(similar to howParamSetforSystemParamwas named)Allows querying this:
Query<DataSet<(&Transform, &mut Transform)>>Possible implementation: Similar to the
ParamSetimplementation.Requires cloning
WorldQuery::Fetchin call toWorldQuery::fetchRequires adding method to the
WorldQuerytrait similar toWorldQuery::shrink, but forWorldQuery::Fetchas input and output so that it is possible to implementWorldQuery::shrinkI 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