Improve EntityWorldMut.remove, retain and despawn docs by linking to more detail (#10943)
## Solution `Commands.remove` and `.retain` (because I copied `remove`s doc) referenced `EntityWorldMut.remove` and `retain` for more detail but the `Commands` docs are much more detailed (which makes sense because it is the most common api), so I have instead inverted this so that `EntityWorldMut` docs link to `Commands`. I also made `EntityWorldMut.despawn` reference `World.despawn` for more details, like `Commands.despawn` does.
This commit is contained in:
parent
4b1865f8bd
commit
6a15ed564d
@ -812,9 +812,6 @@ impl<'w, 's, 'a> EntityCommands<'w, 's, 'a> {
|
||||
|
||||
/// Removes a [`Bundle`] of components from the entity.
|
||||
///
|
||||
/// See [`EntityWorldMut::remove`](EntityWorldMut::remove) for more
|
||||
/// details.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
@ -912,9 +909,6 @@ impl<'w, 's, 'a> EntityCommands<'w, 's, 'a> {
|
||||
///
|
||||
/// This can also be used to remove all the components from the entity by passing it an empty Bundle.
|
||||
///
|
||||
/// See [`EntityWorldMut::retain`](EntityWorldMut::retain) for more
|
||||
/// details.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
|
||||
@ -889,6 +889,8 @@ impl<'w> EntityWorldMut<'w> {
|
||||
}
|
||||
|
||||
/// Removes any components in the [`Bundle`] from the entity.
|
||||
///
|
||||
/// See [`EntityCommands::remove`](crate::system::EntityCommands::remove) for more details.
|
||||
// TODO: BundleRemover?
|
||||
pub fn remove<T: Bundle>(&mut self) -> &mut Self {
|
||||
let archetypes = &mut self.world.archetypes;
|
||||
@ -920,6 +922,8 @@ impl<'w> EntityWorldMut<'w> {
|
||||
}
|
||||
|
||||
/// Removes any components except those in the [`Bundle`] from the entity.
|
||||
///
|
||||
/// See [`EntityCommands::retain`](crate::system::EntityCommands::retain) for more details.
|
||||
pub fn retain<T: Bundle>(&mut self) -> &mut Self {
|
||||
let archetypes = &mut self.world.archetypes;
|
||||
let storages = &mut self.world.storages;
|
||||
@ -961,6 +965,8 @@ impl<'w> EntityWorldMut<'w> {
|
||||
}
|
||||
|
||||
/// Despawns the current entity.
|
||||
///
|
||||
/// See [`World::despawn`] for more details.
|
||||
pub fn despawn(self) {
|
||||
debug!("Despawning entity {:?}", self.entity);
|
||||
let world = self.world;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user