Skip to content

Commit 2756f5a

Browse files
committed
Make from_raw_and_generation public
Otherwise creation with index = 1 and generation = 1 looks like this: ```rust let expected_entity = Entity::from_bits((1 ^ u32::MAX) as u64 | (1 << 32)); ``` I also removed outdated comment which left untouched after the generation rework (bevyengine#19121)
1 parent 1032559 commit 2756f5a

File tree

1 file changed

+2
-7
lines changed
  • crates/bevy_ecs/src/entity

1 file changed

+2
-7
lines changed

crates/bevy_ecs/src/entity/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -445,13 +445,9 @@ impl Hash for Entity {
445445
}
446446

447447
impl Entity {
448-
/// Construct an [`Entity`] from a raw `row` value and a non-zero `generation` value.
449-
/// Ensure that the generation value is never greater than `0x7FFF_FFFF`.
448+
/// Constructs an [`Entity`] from a raw `row` value and a non-zero `generation` value.
450449
#[inline(always)]
451-
pub(crate) const fn from_raw_and_generation(
452-
row: EntityRow,
453-
generation: EntityGeneration,
454-
) -> Entity {
450+
pub const fn from_raw_and_generation(row: EntityRow, generation: EntityGeneration) -> Entity {
455451
Self { row, generation }
456452
}
457453

@@ -1327,7 +1323,6 @@ mod tests {
13271323
let r = EntityRow::new(NonMaxU32::new(0xDEADBEEF).unwrap());
13281324
assert_eq!(EntityRow::from_bits(r.to_bits()), r);
13291325

1330-
// Generation cannot be greater than 0x7FFF_FFFF else it will be an invalid Entity id
13311326
let e = Entity::from_raw_and_generation(
13321327
EntityRow::new(NonMaxU32::new(0xDEADBEEF).unwrap()),
13331328
EntityGeneration::from_bits(0x5AADF00D),

0 commit comments

Comments
 (0)