Skip to content

Commit d637af0

Browse files
more docs fixes
1 parent 4f19233 commit d637af0

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

crates/bevy_asset/src/reflect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl ReflectAsset {
6161
unsafe { (self.get_unchecked_mut)(world.as_interior_mutable(), handle) }
6262
}
6363

64-
/// Equivalent of [`Assets::get_mut`], but works with a [`InteriorMutableWorld`].
64+
/// Equivalent of [`Assets::get_mut`], but works with an [`InteriorMutableWorld`].
6565
///
6666
/// Only use this method when you have ensured that you are the *only* one with access to the [`Assets`] resource of the asset type.
6767
/// Furthermore, this does *not* allow you to have look up two distinct handles,

crates/bevy_ecs/src/reflect.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ pub struct ReflectComponentFns {
5252
/// Function pointer implementing [`ReflectComponent::reflect()`].
5353
pub reflect: fn(&World, Entity) -> Option<&dyn Reflect>,
5454
/// Function pointer implementing [`ReflectComponent::reflect_mut()`].
55-
/// SAFETY: The function may only be called with an InteriorMutableWorld that can be used to mutably access the relevant component on the given entity
55+
///
56+
/// # Safety
57+
/// The function may only be called with an [`InteriorMutableWorld`] that can be used to mutably access the relevant component on the given entity.
5658
pub reflect_mut: unsafe fn(InteriorMutableWorld<'_>, Entity) -> Option<Mut<'_, dyn Reflect>>,
5759
/// Function pointer implementing [`ReflectComponent::copy()`].
5860
pub copy: fn(&World, &mut World, Entity, Entity),
@@ -211,8 +213,8 @@ impl<C: Component + Reflect + FromWorld> FromType<C> for ReflectComponent {
211213
},
212214
reflect_mut: |world, entity| {
213215
// SAFETY: reflect_mut is an unsafe function pointer used by
214-
// 1. `reflect_unchecked_mut` which must be called with an InteriorMutableWorld with access the the component `C` on the `entity`, and
215-
// 2. reflect_mut, which has mutable world access
216+
// 1. `reflect_unchecked_mut` which must be called with an InteriorMutableWorld with access to the the component `C` on the `entity`, and
217+
// 2. `reflect_mut`, which has mutable world access
216218
unsafe {
217219
world.get_entity(entity)?.get_mut::<C>().map(|c| Mut {
218220
value: c.value as &mut dyn Reflect,
@@ -264,7 +266,9 @@ pub struct ReflectResourceFns {
264266
/// Function pointer implementing [`ReflectResource::reflect()`].
265267
pub reflect: fn(&World) -> Option<&dyn Reflect>,
266268
/// Function pointer implementing [`ReflectResource::reflect_unchecked_mut()`].
267-
/// SAFETY: The function may only be called with an InteriorMutableWorld that can be used to mutably access the relevant resource
269+
///
270+
/// # Safety
271+
/// The function may only be called with an [`InteriorMutableWorld`] that can be used to mutably access the relevant resource.
268272
pub reflect_unchecked_mut: unsafe fn(InteriorMutableWorld<'_>) -> Option<Mut<'_, dyn Reflect>>,
269273
/// Function pointer implementing [`ReflectResource::copy()`].
270274
pub copy: fn(&World, &mut World),
@@ -320,7 +324,7 @@ impl ReflectResource {
320324
/// # Safety
321325
/// This method does not prevent you from having two mutable pointers to the same data,
322326
/// violating Rust's aliasing rules. To avoid this:
323-
/// * Only call this method with a [`InteriorMutableWorld`] which can be used to mutably access the resource.
327+
/// * Only call this method with an [`InteriorMutableWorld`] which can be used to mutably access the resource.
324328
/// * Don't call this method more than once in the same scope for a given [`Resource`].
325329
pub unsafe fn reflect_unchecked_mut<'w>(
326330
&self,

0 commit comments

Comments
 (0)