Skip to content

Commit d54da8f

Browse files
committed
Review items
1 parent a6935cf commit d54da8f

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

crates/bevy_ecs/src/query/fetch.rs

+13
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,19 @@ pub unsafe trait WorldQuery {
329329
type State: Send + Sync + Sized;
330330

331331
/// Runtime config value passed to [`WorldQuery::init_state`]
332+
///
333+
/// This is used to pass runtime information that is necessary to construct
334+
/// [`WorldQuery`].
335+
///
336+
/// Statically defined queries for types such as `&T` may obtain a
337+
/// [`ComponentId`] statically, however, a dynamic query would require that
338+
/// [`ComponentId`] is passed at runtime, such that
339+
/// `Self::Config = ComponentId`.
340+
///
341+
/// [`QueryState::new`](crate::query::state::QueryState::new) can be used when
342+
/// `Self::Config: Default` otherwise
343+
/// [`QueryState::new_with_config`](crate::query::state::QueryState::new_with_config)
344+
/// is used to construct [`QueryState`](crate::query::state::QueryState).
332345
type Config;
333346

334347
/// This function manually implements subtyping for the query items.

crates/bevy_ecs/src/query/state.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ impl<Q: WorldQuery, F: ReadOnlyWorldQuery> QueryState<Q, F> {
104104
<Q as WorldQuery>::Config: Default,
105105
<F as WorldQuery>::Config: Default,
106106
{
107-
QueryState::new_with_config(world, Default::default(), Default::default())
107+
let fetch_config = Default::default();
108+
let filter_config = Default::default();
109+
QueryState::new_with_config(world, fetch_config, filter_config)
108110
}
109111

110112
/// Creates a new [`QueryState`] from a given [`World`], config, and inherits the result of `world.id()`.

0 commit comments

Comments
 (0)