Skip to content

Commit db347a5

Browse files
committed
awd
1 parent 52fb80c commit db347a5

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

crates/bevy_ecs/src/world/entity_ref.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -929,17 +929,19 @@ unsafe fn take_component(
929929
}
930930
}
931931

932-
fn contains_component_with_type(
932+
/// # Safety
933+
/// `entity_location` must be within bounds of the given archetype and `entity` must exist inside
934+
/// the archetype
935+
#[inline]
936+
unsafe fn get_component_with_type(
933937
world: &World,
934938
type_id: TypeId,
935939
target: Option<Entity>,
940+
entity: Entity,
936941
location: EntityLocation,
937-
) -> bool {
938-
world
939-
.components
940-
.get_component_id(type_id)
941-
.map(|component_id| contains_component(world, component_id, target, location))
942-
.unwrap_or(false)
942+
) -> Option<*mut u8> {
943+
let component_id = world.components.get_component_id(type_id)?;
944+
get_component(world, component_id, target, entity, location)
943945
}
944946

945947
/// # Safety
@@ -956,19 +958,17 @@ unsafe fn get_component_and_ticks_with_type(
956958
get_component_and_ticks(world, component_id, target, entity, location)
957959
}
958960

959-
/// # Safety
960-
/// `entity_location` must be within bounds of the given archetype and `entity` must exist inside
961-
/// the archetype
962-
#[inline]
963-
unsafe fn get_component_with_type(
961+
fn contains_component_with_type(
964962
world: &World,
965963
type_id: TypeId,
966964
target: Option<Entity>,
967-
entity: Entity,
968965
location: EntityLocation,
969-
) -> Option<*mut u8> {
970-
let component_id = world.components.get_component_id(type_id)?;
971-
get_component(world, component_id, target, entity, location)
966+
) -> bool {
967+
world
968+
.components
969+
.get_component_id(type_id)
970+
.map(|component_id| contains_component(world, component_id, target, location))
971+
.unwrap_or(false)
972972
}
973973

974974
fn contains_component(

0 commit comments

Comments
 (0)