-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disjoint QueryData
access
#15880
base: main
Are you sure you want to change the base?
Disjoint QueryData
access
#15880
Changes from all commits
2cf790b
041ed7c
504a500
1d47074
fed9cfb
d2150b0
575ccfc
095145b
b474ca3
075b615
d1dee59
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -328,7 +328,7 @@ mod tests { | |
component::{Component, Components, Tick}, | ||
entity::{Entities, Entity}, | ||
prelude::{AnyOf, EntityRef}, | ||
query::{Added, Changed, Or, With, Without}, | ||
query::{Added, Changed, DataSet, Or, With, Without}, | ||
removal_detection::RemovedComponents, | ||
result::Result, | ||
schedule::{ | ||
|
@@ -819,6 +819,49 @@ mod tests { | |
run_system(&mut world, sys); | ||
} | ||
|
||
#[test] | ||
fn data_set_system() { | ||
fn sys(mut _query: Query<DataSet<(&mut A, &A)>>) {} | ||
let mut world = World::default(); | ||
run_system(&mut world, sys); | ||
} | ||
|
||
#[test] | ||
#[should_panic] | ||
fn conflicting_query_with_data_set_system() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a should_panic test with the |
||
fn sys(_query_1: Query<&mut A>, _query_2: Query<DataSet<(&mut A, &B)>>) {} | ||
|
||
let mut world = World::default(); | ||
run_system(&mut world, sys); | ||
} | ||
|
||
#[test] | ||
#[should_panic] | ||
fn conflicting_data_set_with_query_system() { | ||
fn sys(_query_1: Query<DataSet<(&mut A, &B)>>, _query_2: Query<&mut A>) {} | ||
|
||
let mut world = World::default(); | ||
run_system(&mut world, sys); | ||
} | ||
|
||
#[test] | ||
#[should_panic] | ||
fn conflicting_data_set_in_second_item_system() { | ||
fn sys(_query_1: Query<DataSet<(&B, &A)>>, _query_2: Query<&mut A>) {} | ||
|
||
let mut world = World::default(); | ||
run_system(&mut world, sys); | ||
} | ||
|
||
#[test] | ||
#[should_panic] | ||
fn conflicting_data_sets_system() { | ||
fn sys(_query_1: Query<DataSet<(&mut A,)>>, _query_2: Query<DataSet<(&mut A, &B)>>) {} | ||
|
||
let mut world = World::default(); | ||
run_system(&mut world, sys); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a should_panic test with the conflict in the second item of the DataSet? |
||
#[derive(Default, Resource)] | ||
struct BufferRes { | ||
_buffer: Vec<u8>, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs should make it clear that the query will fetch entitieis that match the union of all the QueryData's in the DataSet.