Skip to content

Commit 735c433

Browse files
JaySprucealice-i-cecilechescock
authored andcommitted
bevy_ecs/system/commands/ folder docs pass (#18639)
- Lots of nits, formatting, and rephrasing, with the goal of making things more consistent. - Fix outdated error handler explanation in `Commands` and `EntityCommands` docs. - Expand docs for system-related commands. - Remove panic notes if the command only panics with the default error handler. - Update error handling notes for `try_` variants. - Hide `prelude` import in most doctest examples, unless the example uses something that people might not realize is in the prelude (like `Name`). - Remove a couple doctest examples that (in my opinion) didn't make sense. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com>
1 parent 831c57d commit 735c433

File tree

4 files changed

+435
-511
lines changed

4 files changed

+435
-511
lines changed

crates/bevy_ecs/src/system/commands/command.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//! This module contains the definition of the [`Command`] trait, as well as
2-
//! blanket implementations of the trait for closures.
1+
//! Contains the definition of the [`Command`] trait,
2+
//! as well as the blanket implementation of the trait for closures.
33
//!
44
//! It also contains functions that return closures for use with
55
//! [`Commands`](crate::system::Commands).
@@ -183,8 +183,10 @@ where
183183
}
184184
}
185185

186-
/// A [`Command`] that removes a system previously registered with
187-
/// [`World::register_system_cached`].
186+
/// A [`Command`] that removes a system previously registered with one of the following:
187+
/// - [`Commands::run_system_cached`](crate::system::Commands::run_system_cached)
188+
/// - [`World::run_system_cached`]
189+
/// - [`World::register_system_cached`]
188190
pub fn unregister_system_cached<I, O, M, S>(system: S) -> impl Command<Result>
189191
where
190192
I: SystemInput + Send + 'static,

crates/bevy_ecs/src/system/commands/entity_command.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//! This module contains the definition of the [`EntityCommand`] trait, as well as
2-
//! blanket implementations of the trait for closures.
1+
//! Contains the definition of the [`EntityCommand`] trait,
2+
//! as well as the blanket implementation of the trait for closures.
33
//!
44
//! It also contains functions that return closures for use with
55
//! [`EntityCommands`](crate::system::EntityCommands).
@@ -203,9 +203,10 @@ pub fn retain<T: Bundle>() -> impl EntityCommand {
203203
///
204204
/// # Note
205205
///
206-
/// This will also despawn any [`Children`](crate::hierarchy::Children) entities,
207-
/// and any other [`RelationshipTarget`](crate::relationship::RelationshipTarget) that is configured to despawn descendants.
208-
/// This results in "recursive despawn" behavior.
206+
/// This will also despawn the entities in any [`RelationshipTarget`](crate::relationship::RelationshipTarget)
207+
/// that is configured to despawn descendants.
208+
///
209+
/// For example, this will recursively despawn [`Children`](crate::hierarchy::Children).
209210
#[track_caller]
210211
pub fn despawn() -> impl EntityCommand {
211212
let caller = MaybeLocation::caller();
@@ -227,6 +228,7 @@ pub fn observe<E: Event, B: Bundle, M>(
227228
}
228229

229230
/// An [`EntityCommand`] that sends a [`Trigger`](crate::observer::Trigger) targeting an entity.
231+
///
230232
/// This will run any [`Observer`](crate::observer::Observer) of the given [`Event`] watching the entity.
231233
#[track_caller]
232234
pub fn trigger(event: impl Event) -> impl EntityCommand {

0 commit comments

Comments
 (0)