Skip to content

Commit fb7f58b

Browse files
authored
Rename EntityReference to EntityTemplate (#23941)
# Objective `EntityReference` is a template, but it doesn't follow standard naming conventions. `EntityTemplate` follows conventions and is much more self-documenting / instructive. ## Solution - Rename `EntityReference` to `EntityTemplate`
1 parent 18d5d6a commit fb7f58b

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

crates/bevy_ecs/src/template.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ impl<T: Clone + Default + Unpin> FromTemplate for T {
402402
pub trait SpecializeFromTemplate: Sized {}
403403

404404
/// A [`Template`] reference to an [`Entity`].
405-
pub enum EntityReference {
405+
pub enum EntityTemplate {
406406
/// A reference to a specific [`Entity`]
407407
Entity(Entity),
408408
/// A reference to an entity via a [`ScopedEntityIndex`]
@@ -423,19 +423,19 @@ pub struct ScopedEntityIndex {
423423
pub index: usize,
424424
}
425425

426-
impl Default for EntityReference {
426+
impl Default for EntityTemplate {
427427
fn default() -> Self {
428428
Self::ScopedEntityIndex(ScopedEntityIndex { scope: 0, index: 0 })
429429
}
430430
}
431431

432-
impl From<Entity> for EntityReference {
432+
impl From<Entity> for EntityTemplate {
433433
fn from(entity: Entity) -> Self {
434434
Self::Entity(entity)
435435
}
436436
}
437437

438-
impl Template for EntityReference {
438+
impl Template for EntityTemplate {
439439
type Output = Entity;
440440

441441
fn build_template(&self, context: &mut TemplateContext) -> Result<Self::Output> {
@@ -458,7 +458,7 @@ impl Template for EntityReference {
458458
}
459459

460460
impl FromTemplate for Entity {
461-
type Template = EntityReference;
461+
type Template = EntityTemplate;
462462
}
463463

464464
/// A [`Template`] driven by a function that returns an output. This is used to create "free floating" templates without

crates/bevy_scene/macros/src/bsn/codegen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ impl BsnType {
432432
let index = ctx.entity_refs.get(ident.to_string());
433433
let bevy_ecs = ctx.bevy_ecs;
434434
assignments.push(quote! {
435-
#(#base_path.)*#member = #bevy_ecs::template::EntityReference::ScopedEntityIndex(
435+
#(#base_path.)*#member = #bevy_ecs::template::EntityTemplate::ScopedEntityIndex(
436436
#bevy_ecs::template::ScopedEntityIndex {
437437
scope: _context.current_entity_scope(), index: #index
438438
}

0 commit comments

Comments
 (0)