Skip to content

Commit c5708d9

Browse files
committed
Reduce code duplication
1 parent aa9bba5 commit c5708d9

File tree

1 file changed

+3
-20
lines changed
  • crates/bevy_ecs/src/entity

1 file changed

+3
-20
lines changed

crates/bevy_ecs/src/entity/mod.rs

+3-20
Original file line numberDiff line numberDiff line change
@@ -47,32 +47,15 @@ use std::{
4747
/// `Entity` can be a part of a query, e.g. `Query<(Entity, &MyComponent)>`.
4848
/// Components of a specific entity can be accessed using
4949
/// [`Query::get`](crate::system::Query::get) and related methods.
50-
#[cfg(target_endian = "little")]
5150
#[derive(Clone, Copy)]
5251
#[repr(C, align(8))]
5352
pub struct Entity {
5453
// Do not reorder the fields here. The ordering is explicitly used by repr(C)
55-
// to make this struct equivalent to a u64 on little endian systems.
54+
// to make this struct equivalent to a u64.
55+
#[cfg(target_endian = "little")]
5656
pub(crate) id: u32,
5757
pub(crate) generation: u32,
58-
}
59-
60-
/// Lightweight unique ID of an entity.
61-
///
62-
/// Obtained from [`World::spawn`](crate::world::World::spawn), typically via
63-
/// [`Commands::spawn`](crate::system::Commands::spawn). Can be stored to refer to an entity in the
64-
/// future.
65-
///
66-
/// `Entity` can be a part of a query, e.g. `Query<(Entity, &MyComponent)>`.
67-
/// Components of a specific entity can be accessed using
68-
/// [`Query::get`](crate::system::Query::get) and related methods.
69-
#[cfg(target_endian = "big")]
70-
#[derive(Clone, Copy)]
71-
#[repr(C, align(8))]
72-
pub struct Entity {
73-
// Do not reorder the fields here. The ordering is explicitly used by repr(C)
74-
// to make this struct equivalent to a u64 on big endian systems.
75-
pub(crate) generation: u32,
58+
#[cfg(target_endian = "big")]
7659
pub(crate) id: u32,
7760
}
7861

0 commit comments

Comments
 (0)