Skip to content

Commit

Permalink
Remove unused unsafe methods
Browse files Browse the repository at this point in the history
  • Loading branch information
memoryruins committed Nov 9, 2020
1 parent 5720934 commit f753bd5
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions crates/bevy_ecs/src/system/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,6 @@ impl<'a, Q: HecsQuery> Query<'a, Q> {
unsafe { self.world.query_unchecked() }
}

/// Iterates over the query results
/// # Safety
/// This allows aliased mutability. You must make sure this call does not result in multiple mutable references to the same component
#[inline]
pub unsafe fn iter_unsafe(&self) -> QueryIter<'_, Q> {
// SAFE: system runs without conflicts with other systems. same-system queries have runtime borrow checks when they conflict
self.world.query_unchecked()
}

#[inline]
pub fn par_iter(&self, batch_size: usize) -> ParIter<'_, Q>
where
Expand Down Expand Up @@ -108,19 +99,6 @@ impl<'a, Q: HecsQuery> Query<'a, Q> {
}
}

/// Gets the query result for the given `entity`
/// # Safety
/// This allows aliased mutability. You must make sure this call does not result in multiple mutable references to the same component
#[inline]
pub unsafe fn get_unsafe(
&self,
entity: Entity,
) -> Result<<Q::Fetch as Fetch>::Item, QueryError> {
self.world
.query_one_unchecked::<Q>(entity)
.map_err(|_err| QueryError::NoSuchEntity)
}

/// Gets a reference to the entity's component of the given type. This will fail if the entity does not have
/// the given component type or if the given component type does not match this query.
pub fn get_component<T: Component>(&self, entity: Entity) -> Result<&T, QueryError> {
Expand Down Expand Up @@ -169,19 +147,6 @@ impl<'a, Q: HecsQuery> Query<'a, Q> {
}
}

/// Gets a mutable reference to the entity's component of the given type. This will fail if the entity does not have
/// the given component type
/// # Safety
/// This allows aliased mutability. You must make sure this call does not result in multiple mutable references to the same component
pub unsafe fn get_component_unsafe<T: Component>(
&self,
entity: Entity,
) -> Result<Mut<'_, T>, QueryError> {
self.world
.get_mut_unchecked(entity)
.map_err(QueryError::ComponentError)
}

pub fn removed<C: Component>(&self) -> &[Entity] {
self.world.removed::<C>()
}
Expand Down

0 comments on commit f753bd5

Please sign in to comment.