Skip to content

Commit 4fad095

Browse files
committed
Rename Q to D (squash commit)
1 parent f90248b commit 4fad095

File tree

10 files changed

+273
-273
lines changed

10 files changed

+273
-273
lines changed

crates/bevy_ecs/src/query/fetch.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ pub unsafe trait ReadOnlyWorldQueryData: WorldQueryData<ReadOnly = Self> {}
272272
/// The item type returned when a [`WorldQuery`] is iterated over
273273
pub type QueryItem<'w, Q> = <Q as WorldQuery>::Item<'w>;
274274
/// The read-only variant of the item type returned when a [`WorldQueryData`] is iterated over immutably
275-
pub type ROQueryItem<'w, Q> = QueryItem<'w, <Q as WorldQueryData>::ReadOnly>;
275+
pub type ROQueryItem<'w, D> = QueryItem<'w, <D as WorldQueryData>::ReadOnly>;
276276

277277
/// SAFETY:
278278
/// `update_component_access` and `update_archetype_component_access` do nothing.
@@ -1399,27 +1399,27 @@ macro_rules! impl_anytuple_fetch {
13991399
all_tuples!(impl_tuple_world_query_data, 0, 15, F, S);
14001400
all_tuples!(impl_anytuple_fetch, 0, 15, F, S);
14011401

1402-
/// [`WorldQuery`] used to nullify queries by turning `Query<Q>` into `Query<NopWorldQuery<Q>>`
1402+
/// [`WorldQuery`] used to nullify queries by turning `Query<D>` into `Query<NopWorldQuery<D>>`
14031403
///
14041404
/// This will rarely be useful to consumers of `bevy_ecs`.
1405-
pub struct NopWorldQuery<Q: WorldQueryData>(PhantomData<Q>);
1405+
pub struct NopWorldQuery<D: WorldQueryData>(PhantomData<D>);
14061406

14071407
/// SAFETY:
14081408
/// `update_component_access` and `update_archetype_component_access` do nothing.
14091409
/// This is sound because `fetch` does not access components.
1410-
unsafe impl<Q: WorldQueryData> WorldQuery for NopWorldQuery<Q> {
1410+
unsafe impl<D: WorldQueryData> WorldQuery for NopWorldQuery<D> {
14111411
type Fetch<'w> = ();
14121412
type Item<'w> = ();
1413-
type State = Q::State;
1413+
type State = D::State;
14141414

14151415
fn shrink<'wlong: 'wshort, 'wshort>(_: ()) {}
14161416

1417-
const IS_DENSE: bool = Q::IS_DENSE;
1417+
const IS_DENSE: bool = D::IS_DENSE;
14181418

14191419
#[inline(always)]
14201420
unsafe fn init_fetch(
14211421
_world: UnsafeWorldCell,
1422-
_state: &Q::State,
1422+
_state: &D::State,
14231423
_last_run: Tick,
14241424
_this_run: Tick,
14251425
) {
@@ -1428,14 +1428,14 @@ unsafe impl<Q: WorldQueryData> WorldQuery for NopWorldQuery<Q> {
14281428
#[inline(always)]
14291429
unsafe fn set_archetype(
14301430
_fetch: &mut (),
1431-
_state: &Q::State,
1431+
_state: &D::State,
14321432
_archetype: &Archetype,
14331433
_tables: &Table,
14341434
) {
14351435
}
14361436

14371437
#[inline(always)]
1438-
unsafe fn set_table<'w>(_fetch: &mut (), _state: &Q::State, _table: &Table) {}
1438+
unsafe fn set_table<'w>(_fetch: &mut (), _state: &D::State, _table: &Table) {}
14391439

14401440
#[inline(always)]
14411441
unsafe fn fetch<'w>(
@@ -1445,34 +1445,34 @@ unsafe impl<Q: WorldQueryData> WorldQuery for NopWorldQuery<Q> {
14451445
) -> Self::Item<'w> {
14461446
}
14471447

1448-
fn update_component_access(_state: &Q::State, _access: &mut FilteredAccess<ComponentId>) {}
1448+
fn update_component_access(_state: &D::State, _access: &mut FilteredAccess<ComponentId>) {}
14491449

14501450
fn update_archetype_component_access(
1451-
_state: &Q::State,
1451+
_state: &D::State,
14521452
_archetype: &Archetype,
14531453
_access: &mut Access<ArchetypeComponentId>,
14541454
) {
14551455
}
14561456

14571457
fn init_state(world: &mut World) -> Self::State {
1458-
Q::init_state(world)
1458+
D::init_state(world)
14591459
}
14601460

14611461
fn matches_component_set(
14621462
state: &Self::State,
14631463
set_contains_id: &impl Fn(ComponentId) -> bool,
14641464
) -> bool {
1465-
Q::matches_component_set(state, set_contains_id)
1465+
D::matches_component_set(state, set_contains_id)
14661466
}
14671467
}
14681468

14691469
/// SAFETY: `Self::ReadOnly` is `Self`
1470-
unsafe impl<Q: WorldQueryData> WorldQueryData for NopWorldQuery<Q> {
1470+
unsafe impl<D: WorldQueryData> WorldQueryData for NopWorldQuery<D> {
14711471
type ReadOnly = Self;
14721472
}
14731473

14741474
/// SAFETY: `NopFetch` never accesses any data
1475-
unsafe impl<Q: WorldQueryData> ReadOnlyWorldQueryData for NopWorldQuery<Q> {}
1475+
unsafe impl<D: WorldQueryData> ReadOnlyWorldQueryData for NopWorldQuery<D> {}
14761476

14771477
/// SAFETY:
14781478
/// `update_component_access` and `update_archetype_component_access` do nothing.
@@ -1601,14 +1601,14 @@ mod tests {
16011601

16021602
#[derive(WorldQueryData)]
16031603
#[world_query_data(mutable)]
1604-
pub struct Q {
1604+
pub struct D {
16051605
pub a: &'static mut A,
16061606
}
16071607
}
16081608

1609-
let _ = private::QReadOnly { a: &A };
1609+
let _ = private::DReadOnly { a: &A };
16101610

1611-
fn my_system(query: Query<private::Q>) {
1611+
fn my_system(query: Query<private::D>) {
16121612
for q in &query {
16131613
let _ = &q.a;
16141614
}

0 commit comments

Comments
 (0)