Skip to content

Commit

Permalink
Review items
Browse files Browse the repository at this point in the history
  • Loading branch information
Suficio committed Jun 13, 2023
1 parent a6935cf commit d54da8f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions crates/bevy_ecs/src/query/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,19 @@ pub unsafe trait WorldQuery {
type State: Send + Sync + Sized;

/// Runtime config value passed to [`WorldQuery::init_state`]
///
/// This is used to pass runtime information that is necessary to construct
/// [`WorldQuery`].
///
/// Statically defined queries for types such as `&T` may obtain a
/// [`ComponentId`] statically, however, a dynamic query would require that
/// [`ComponentId`] is passed at runtime, such that
/// `Self::Config = ComponentId`.
///
/// [`QueryState::new`](crate::query::state::QueryState::new) can be used when
/// `Self::Config: Default` otherwise
/// [`QueryState::new_with_config`](crate::query::state::QueryState::new_with_config)
/// is used to construct [`QueryState`](crate::query::state::QueryState).
type Config;

/// This function manually implements subtyping for the query items.
Expand Down
4 changes: 3 additions & 1 deletion crates/bevy_ecs/src/query/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ impl<Q: WorldQuery, F: ReadOnlyWorldQuery> QueryState<Q, F> {
<Q as WorldQuery>::Config: Default,
<F as WorldQuery>::Config: Default,
{
QueryState::new_with_config(world, Default::default(), Default::default())
let fetch_config = Default::default();
let filter_config = Default::default();
QueryState::new_with_config(world, fetch_config, filter_config)
}

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

0 comments on commit d54da8f

Please sign in to comment.