Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions crates/bevy_ecs/src/world/entity_access/entity_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,19 @@ impl<'w> EntityMut<'w> {
}

/// Returns read-only components for the current entity that match the query `Q`,
/// or `None` if the entity does not have the components required by the query `Q`.
/// or [`QueryAccessError`] if the entity does not have the components required by the query `Q`.
pub fn get_components<Q: ReadOnlyQueryData + ReleaseStateQueryData + SingleEntityQueryData>(
&self,
) -> Result<Q::Item<'_, 'static>, QueryAccessError> {
self.as_readonly().get_components::<Q>()
}

/// Returns components for the current entity that match the query `Q`,
/// or `None` if the entity does not have the components required by the query `Q`.
/// or [`QueryAccessError`] if the entity does not have the components required by the query `Q`.
///
/// # Safety
/// It is the caller's responsibility to ensure that
/// the `QueryData` does not provide aliasing mutable references to the same component.
///
/// # Example
///
Expand All @@ -208,10 +212,6 @@ impl<'w> EntityMut<'w> {
/// // entity.get_components_mut_unchecked::<(&mut X, &mut X)>();
/// ```
///
/// # Safety
/// It is the caller's responsibility to ensure that
/// the `QueryData` does not provide aliasing mutable references to the same component.
///
/// # See also
///
/// - [`Self::get_components_mut`] for the safe version that performs aliasing checks
Expand Down Expand Up @@ -252,7 +252,11 @@ impl<'w> EntityMut<'w> {
}

/// Consumes self and returns components for the current entity that match the query `Q` for the world lifetime `'w`,
/// or `None` if the entity does not have the components required by the query `Q`.
/// or [`QueryAccessError`] if the entity does not have the components required by the query `Q`.
///
/// # Safety
/// It is the caller's responsibility to ensure that
/// the `QueryData` does not provide aliasing mutable references to the same component.
///
/// # Example
///
Expand All @@ -276,10 +280,6 @@ impl<'w> EntityMut<'w> {
/// // entity.into_components_mut_unchecked::<(&mut X, &mut X)>();
/// ```
///
/// # Safety
/// It is the caller's responsibility to ensure that
/// the `QueryData` does not provide aliasing mutable references to the same component.
///
/// # See also
///
/// - [`Self::into_components_mut`] for the safe version that performs aliasing checks
Expand All @@ -295,7 +295,7 @@ impl<'w> EntityMut<'w> {
}

/// Consumes self and returns components for the current entity that match the query `Q` for the world lifetime `'w`,
/// or `None` if the entity does not have the components required by the query `Q`.
/// or [`QueryAccessError`] if the entity does not have the components required by the query `Q`.
///
/// The checks for aliasing mutable references may be expensive.
/// If performance is a concern, consider making multiple calls to [`Self::get_mut`].
Expand Down