Relaxed documented safety requirements for *_assume_mut
This commit is contained in:
parent
859c2d77f9
commit
2cfdc7ccad
@ -581,7 +581,11 @@ impl<'w> EntityMut<'w> {
|
|||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// - `T` must be a mutable component
|
/// - One of the following should be true:
|
||||||
|
/// - Either `T` is mutable, or
|
||||||
|
/// - `OnReplace` hooks and observers for that component on that entity should trigger immediately before the mutation
|
||||||
|
/// and `OnInsert` should trigger immediately after the mutation, or
|
||||||
|
/// - The user should uphold documented invariants of `T`. If no such documentation provided, it is impossible for the end user to uphold this.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn get_mut_assume_mutable<T: Component>(&mut self) -> Option<Mut<'_, T>> {
|
pub unsafe fn get_mut_assume_mutable<T: Component>(&mut self) -> Option<Mut<'_, T>> {
|
||||||
// SAFETY: &mut self implies exclusive access for duration of returned value
|
// SAFETY: &mut self implies exclusive access for duration of returned value
|
||||||
@ -1262,7 +1266,11 @@ impl<'w> EntityWorldMut<'w> {
|
|||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// - `T` must be a mutable component
|
/// - One of the following should be true:
|
||||||
|
/// - Either `T` is mutable, or
|
||||||
|
/// - `OnReplace` hooks and observers for that component on that entity should trigger immediately before the mutation
|
||||||
|
/// and `OnInsert` should trigger immediately after the mutation, or
|
||||||
|
/// - The user should uphold documented invariants of `T`. If no such documentation provided, it is impossible for the end user to uphold this.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn get_mut_assume_mutable<T: Component>(&mut self) -> Option<Mut<'_, T>> {
|
pub unsafe fn get_mut_assume_mutable<T: Component>(&mut self) -> Option<Mut<'_, T>> {
|
||||||
// SAFETY:
|
// SAFETY:
|
||||||
@ -3313,7 +3321,11 @@ impl<'w> FilteredEntityMut<'w> {
|
|||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// - `T` must be a mutable component
|
/// - One of the following should be true:
|
||||||
|
/// - Either `T` is mutable, or
|
||||||
|
/// - `OnReplace` hooks and observers for that component on that entity should trigger immediately before the mutation
|
||||||
|
/// and `OnInsert` should trigger immediately after the mutation, or
|
||||||
|
/// - The user should uphold documented invariants of `T`. If no such documentation provided, it is impossible for the end user to uphold this.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn into_mut_assume_mutable<T: Component>(self) -> Option<Mut<'w, T>> {
|
pub unsafe fn into_mut_assume_mutable<T: Component>(self) -> Option<Mut<'w, T>> {
|
||||||
let id = self.entity.world().components().get_id(TypeId::of::<T>())?;
|
let id = self.entity.world().components().get_id(TypeId::of::<T>())?;
|
||||||
|
@ -863,7 +863,11 @@ impl<'w> UnsafeEntityCell<'w> {
|
|||||||
/// It is the callers responsibility to ensure that
|
/// It is the callers responsibility to ensure that
|
||||||
/// - the [`UnsafeEntityCell`] has permission to access the component mutably
|
/// - the [`UnsafeEntityCell`] has permission to access the component mutably
|
||||||
/// - no other references to the component exist at the same time
|
/// - no other references to the component exist at the same time
|
||||||
/// - the component `T` is mutable
|
/// - One of the following should be true:
|
||||||
|
/// - Either `T` is mutable, or
|
||||||
|
/// - `OnReplace` hooks and observers for that component on that entity should trigger immediately before the mutation
|
||||||
|
/// and `OnInsert` should trigger immediately after the mutation, or
|
||||||
|
/// - The user should uphold documented invariants of `T`. If no such documentation provided, it is impossible for the end user to uphold this.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn get_mut_assume_mutable<T: Component>(self) -> Option<Mut<'w, T>> {
|
pub unsafe fn get_mut_assume_mutable<T: Component>(self) -> Option<Mut<'w, T>> {
|
||||||
// SAFETY: same safety requirements
|
// SAFETY: same safety requirements
|
||||||
@ -879,7 +883,11 @@ impl<'w> UnsafeEntityCell<'w> {
|
|||||||
/// It is the callers responsibility to ensure that
|
/// It is the callers responsibility to ensure that
|
||||||
/// - the [`UnsafeEntityCell`] has permission to access the component mutably
|
/// - the [`UnsafeEntityCell`] has permission to access the component mutably
|
||||||
/// - no other references to the component exist at the same time
|
/// - no other references to the component exist at the same time
|
||||||
/// - The component `T` is mutable
|
/// - One of the following should be true:
|
||||||
|
/// - Either `T` is mutable, or
|
||||||
|
/// - `OnReplace` hooks and observers for that component on that entity should trigger immediately before the mutation
|
||||||
|
/// and `OnInsert` should trigger immediately after the mutation, or
|
||||||
|
/// - The user should uphold documented invariants of `T`. If no such documentation provided, it is impossible for the end user to uphold this.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub(crate) unsafe fn get_mut_using_ticks_assume_mutable<T: Component>(
|
pub(crate) unsafe fn get_mut_using_ticks_assume_mutable<T: Component>(
|
||||||
&self,
|
&self,
|
||||||
|
Loading…
Reference in New Issue
Block a user