1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
use Query;
use PhantomData;
/// A zero-sized `Copy` type used to describe queries of a system, and prepare them
/// via methods of [`SystemContext`](struct.SystemContext.html).
///
/// Instantiating these directly is only useful when calling systems as plain functions,
/// and can be done either by `QueryMarker::new()`, `QueryMarker::default()`, or
/// `Default::default()`, the latter of which can also instantiate tuples of markers (up to 10):
/// ```rust
/// # use yaks::{SystemContext, QueryMarker};
/// # let world = hecs::World::new();
/// # let world = &world;
/// # let mut average = 0f32;
/// fn single_query(context: SystemContext, average: &mut f32, query: QueryMarker<&f32>) {
/// *average = 0f32;
/// let mut entities = 0;
/// for (_entity, value) in context.query(query).iter() {
/// entities += 1;
/// *average += *value;
/// }
/// *average /= entities as f32;
/// }
///
/// single_query(world.into(), &mut average, QueryMarker::new());
/// single_query(world.into(), &mut average, QueryMarker::default());
/// single_query(world.into(), &mut average, Default::default());
///
/// fn two_queries(
/// context: SystemContext,
/// average: &mut f32,
/// (floats, ints): (QueryMarker<&f32>, QueryMarker<&i32>),
/// ) {
/// *average = 0f32;
/// let mut entities = 0;
/// for (_entity, value) in context.query(floats).iter() {
/// entities += 1;
/// *average += *value;
/// }
/// for (_entity, value) in context.query(ints).iter() {
/// entities += 1;
/// *average += *value as f32;
/// }
/// *average /= entities as f32;
/// }
///
/// two_queries(world.into(), &mut average, Default::default());
/// ```
/// # Instantiating markers inside a system is improper!
/// While it's possible to instantiate a marker within a system and use it to prepare a query,
/// doing so does not inform the executor the system may be in of said query,
/// and may lead to a panic.
where
Q0: Query;