Fix a few typos in bevy_ecs docs (#19280)

# Objective

Fix a few minor typos that I noticed when reading the docs.
This commit is contained in:
theotherphil 2025-05-26 21:02:13 +01:00 committed by GitHub
parent 7c4a1f9d87
commit f8cb8f237d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 31 deletions

View File

@ -115,7 +115,7 @@ use core::{
/// ```
///
/// Note that the filter is `With<ComponentB>`, not `With<&ComponentB>`. Unlike query data, `With`
/// does require components to be behind a reference.
/// does not require components to be behind a reference.
///
/// ## `QueryData` or `QueryFilter` tuples
///
@ -209,7 +209,7 @@ use core::{
/// # #[derive(Component)]
/// # struct ComponentB;
/// #
/// // A queried items must contain `ComponentA`. If they also contain `ComponentB`, its value will
/// // Queried items must contain `ComponentA`. If they also contain `ComponentB`, its value will
/// // be fetched as well.
/// fn optional_component_query(query: Query<(&ComponentA, Option<&ComponentB>)>) {
/// // ...

View File

@ -199,13 +199,13 @@ impl<'w> UnsafeWorldCell<'w> {
///
/// # Safety
/// - must have permission to access the whole world immutably
/// - there must be no live exclusive borrows on world data
/// - there must be no live exclusive borrows of world data
/// - there must be no live exclusive borrow of world
#[inline]
pub unsafe fn world(self) -> &'w World {
// SAFETY:
// - caller ensures there is no `&mut World` this makes it okay to make a `&World`
// - caller ensures there is no mutable borrows of world data, this means the caller cannot
// - caller ensures there are no mutable borrows of world data, this means the caller cannot
// misuse the returned `&World`
unsafe { self.unsafe_world() }
}
@ -234,7 +234,7 @@ impl<'w> UnsafeWorldCell<'w> {
///
/// # Safety
/// - must not be used in a way that would conflict with any
/// live exclusive borrows on world data
/// live exclusive borrows of world data
#[inline]
unsafe fn unsafe_world(self) -> &'w World {
// SAFETY:
@ -396,7 +396,7 @@ impl<'w> UnsafeWorldCell<'w> {
/// Gets a reference to the resource of the given type if it exists
///
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeWorldCell`] has permission to access the resource
/// - no mutable reference to the resource exists at the same time
#[inline]
@ -414,7 +414,7 @@ impl<'w> UnsafeWorldCell<'w> {
/// Gets a reference including change detection to the resource of the given type if it exists.
///
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeWorldCell`] has permission to access the resource
/// - no mutable reference to the resource exists at the same time
#[inline]
@ -422,7 +422,7 @@ impl<'w> UnsafeWorldCell<'w> {
let component_id = self.components().get_resource_id(TypeId::of::<R>())?;
// SAFETY: caller ensures `self` has permission to access the resource
// caller also ensure that no mutable reference to the resource exists
// caller also ensures that no mutable reference to the resource exists
let (ptr, ticks, caller) = unsafe { self.get_resource_with_ticks(component_id)? };
// SAFETY: `component_id` was obtained from the type ID of `R`
@ -450,7 +450,7 @@ impl<'w> UnsafeWorldCell<'w> {
/// use this in cases where the actual types are not known at compile time.**
///
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeWorldCell`] has permission to access the resource
/// - no mutable reference to the resource exists at the same time
#[inline]
@ -466,7 +466,7 @@ impl<'w> UnsafeWorldCell<'w> {
/// Gets a reference to the non-send resource of the given type if it exists
///
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeWorldCell`] has permission to access the resource
/// - no mutable reference to the resource exists at the same time
#[inline]
@ -492,7 +492,7 @@ impl<'w> UnsafeWorldCell<'w> {
/// This function will panic if it isn't called from the same thread that the resource was inserted from.
///
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeWorldCell`] has permission to access the resource
/// - no mutable reference to the resource exists at the same time
#[inline]
@ -508,7 +508,7 @@ impl<'w> UnsafeWorldCell<'w> {
/// Gets a mutable reference to the resource of the given type if it exists
///
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeWorldCell`] has permission to access the resource mutably
/// - no other references to the resource exist at the same time
#[inline]
@ -533,7 +533,7 @@ impl<'w> UnsafeWorldCell<'w> {
/// use this in cases where the actual types are not known at compile time.**
///
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeWorldCell`] has permission to access the resource mutably
/// - no other references to the resource exist at the same time
#[inline]
@ -572,7 +572,7 @@ impl<'w> UnsafeWorldCell<'w> {
/// Gets a mutable reference to the non-send resource of the given type if it exists
///
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeWorldCell`] has permission to access the resource mutably
/// - no other references to the resource exist at the same time
#[inline]
@ -600,7 +600,7 @@ impl<'w> UnsafeWorldCell<'w> {
/// This function will panic if it isn't called from the same thread that the resource was inserted from.
///
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeWorldCell`] has permission to access the resource mutably
/// - no other references to the resource exist at the same time
#[inline]
@ -634,7 +634,7 @@ impl<'w> UnsafeWorldCell<'w> {
// Shorthand helper function for getting the data and change ticks for a resource.
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeWorldCell`] has permission to access the resource mutably
/// - no mutable references to the resource exist at the same time
#[inline]
@ -661,7 +661,7 @@ impl<'w> UnsafeWorldCell<'w> {
/// This function will panic if it isn't called from the same thread that the resource was inserted from.
///
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeWorldCell`] has permission to access the resource mutably
/// - no mutable references to the resource exist at the same time
#[inline]
@ -685,7 +685,7 @@ impl<'w> UnsafeWorldCell<'w> {
// Returns a mutable reference to the underlying world's [`CommandQueue`].
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeWorldCell`] has permission to access the queue mutably
/// - no mutable references to the queue exist at the same time
pub(crate) unsafe fn get_raw_command_queue(self) -> RawCommandQueue {
@ -697,7 +697,7 @@ impl<'w> UnsafeWorldCell<'w> {
}
/// # Safety
/// It is the callers responsibility to ensure that there are no outstanding
/// It is the caller's responsibility to ensure that there are no outstanding
/// references to `last_trigger_id`.
pub(crate) unsafe fn increment_trigger_id(self) {
self.assert_allows_mutable_access();
@ -727,7 +727,7 @@ impl Debug for UnsafeWorldCell<'_> {
}
}
/// A interior-mutable reference to a particular [`Entity`] and all of its components
/// An interior-mutable reference to a particular [`Entity`] and all of its components
#[derive(Copy, Clone)]
pub struct UnsafeEntityCell<'w> {
world: UnsafeWorldCell<'w>,
@ -821,7 +821,7 @@ impl<'w> UnsafeEntityCell<'w> {
}
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeEntityCell`] has permission to access the component
/// - no other mutable references to the component exist at the same time
#[inline]
@ -845,7 +845,7 @@ impl<'w> UnsafeEntityCell<'w> {
}
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeEntityCell`] has permission to access the component
/// - no other mutable references to the component exist at the same time
#[inline]
@ -879,7 +879,7 @@ impl<'w> UnsafeEntityCell<'w> {
/// detection in custom runtimes.
///
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeEntityCell`] has permission to access the component
/// - no other mutable references to the component exist at the same time
#[inline]
@ -908,7 +908,7 @@ impl<'w> UnsafeEntityCell<'w> {
/// compile time.**
///
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeEntityCell`] has permission to access the component
/// - no other mutable references to the component exist at the same time
#[inline]
@ -933,7 +933,7 @@ impl<'w> UnsafeEntityCell<'w> {
}
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeEntityCell`] has permission to access the component mutably
/// - no other references to the component exist at the same time
#[inline]
@ -945,7 +945,7 @@ impl<'w> UnsafeEntityCell<'w> {
}
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeEntityCell`] has permission to access the component mutably
/// - no other references to the component exist at the same time
/// - the component `T` is mutable
@ -956,7 +956,7 @@ impl<'w> UnsafeEntityCell<'w> {
}
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeEntityCell`] has permission to access the component mutably
/// - no other references to the component exist at the same time
/// - The component `T` is mutable
@ -995,7 +995,7 @@ impl<'w> UnsafeEntityCell<'w> {
/// or `None` if the entity does not have the components required by the query `Q`.
///
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeEntityCell`] has permission to access the queried data immutably
/// - no mutable references to the queried data exist at the same time
pub(crate) unsafe fn get_components<Q: ReadOnlyQueryData>(&self) -> Option<Q::Item<'w>> {
@ -1044,7 +1044,7 @@ impl<'w> UnsafeEntityCell<'w> {
/// which is only valid while the `'w` borrow of the lifetime is active.
///
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeEntityCell`] has permission to access the component
/// - no other mutable references to the component exist at the same time
#[inline]
@ -1069,7 +1069,7 @@ impl<'w> UnsafeEntityCell<'w> {
/// use this in cases where the actual types are not known at compile time.**
///
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeEntityCell`] has permission to access the component mutably
/// - no other references to the component exist at the same time
#[inline]
@ -1117,7 +1117,7 @@ impl<'w> UnsafeEntityCell<'w> {
/// use this in cases where the actual types are not known at compile time.**
///
/// # Safety
/// It is the callers responsibility to ensure that
/// It is the caller's responsibility to ensure that
/// - the [`UnsafeEntityCell`] has permission to access the component mutably
/// - no other references to the component exist at the same time
/// - the component `T` is mutable