@@ -89,14 +89,19 @@ use crate::{
89
89
///
90
90
/// # Error handling
91
91
///
92
- /// Commands can return a [`Result`](crate::result::Result), which can be passed to
93
- /// an error handler. Error handlers are functions/closures of the form
94
- /// `fn(&mut World, CommandError)`.
92
+ /// A [`Command`] can return a [`Result`](crate::result::Result),
93
+ /// which will be passed to an error handler if the `Result` is an error.
95
94
///
96
- /// The default error handler panics. It can be configured by enabling the `configurable_error_handler`
97
- /// cargo feature, then setting the `GLOBAL_ERROR_HANDLER`.
95
+ /// Error handlers are functions/closures of the form `fn(&mut World, Error)`.
96
+ /// They are granted exclusive access to the [`World`], which enables them to
97
+ /// respond to the error in whatever way is necessary.
98
98
///
99
- /// Alternatively, you can customize the error handler for a specific command by calling [`Commands::queue_handled`].
99
+ /// The [default error handler](error_handler::default) panics.
100
+ /// It can be configured by enabling the `configurable_error_handler` cargo feature,
101
+ /// then setting the `GLOBAL_ERROR_HANDLER`.
102
+ ///
103
+ /// Alternatively, you can customize the error handler for a specific command
104
+ /// by calling [`Commands::queue_handled`].
100
105
///
101
106
/// The [`error_handler`] module provides some simple error handlers for convenience.
102
107
///
@@ -546,7 +551,8 @@ impl<'w, 's> Commands<'w, 's> {
546
551
547
552
/// Pushes a generic [`Command`] to the command queue.
548
553
///
549
- /// If the [`Command`] returns a [`Result`], it will be handled using the [default error handler](error_handler::default).
554
+ /// If the [`Command`] returns a [`Result`],
555
+ /// it will be handled using the [default error handler](error_handler::default).
550
556
///
551
557
/// To use a custom error handler, see [`Commands::queue_handled`].
552
558
///
@@ -589,8 +595,11 @@ impl<'w, 's> Commands<'w, 's> {
589
595
pub fn queue < C : Command < T > + HandleError < T > , T > ( & mut self , command : C ) {
590
596
self . queue_internal ( command. handle_error ( ) ) ;
591
597
}
592
- /// Pushes a generic [`Command`] to the command queue. If the command returns a [`Result`] the given
593
- /// `error_handler` will be used to handle error cases.
598
+
599
+ /// Pushes a generic [`Command`] to the command queue.
600
+ ///
601
+ /// If the [`Command`] returns a [`Result`],
602
+ /// the given `error_handler` will be used to handle error cases.
594
603
///
595
604
/// To implicitly use the default error handler, see [`Commands::queue`].
596
605
///
@@ -1137,7 +1146,7 @@ impl<'w, 's> Commands<'w, 's> {
1137
1146
/// Most [`Commands`] (and thereby [`EntityCommands`]) are deferred: when you call the command,
1138
1147
/// if it requires mutable access to the [`World`] (that is, if it removes, adds, or changes something),
1139
1148
/// it's not executed immediately. Instead, the command is added to a "command queue."
1140
- /// The command queue is applied between [`Schedules`](bevy_ecs ::schedule::Schedule), one by one,
1149
+ /// The command queue is applied between [`Schedules`](crate ::schedule::Schedule), one by one,
1141
1150
/// so that each command can have exclusive access to the World.
1142
1151
///
1143
1152
/// # Fallible
@@ -1148,14 +1157,19 @@ impl<'w, 's> Commands<'w, 's> {
1148
1157
///
1149
1158
/// # Error handling
1150
1159
///
1151
- /// [`EntityCommands`] can return a [`Result`](crate::result::Result), which can be passed to
1152
- /// an error handler. Error handlers are functions/closures of the form
1153
- /// `fn(&mut World, CommandError)`.
1160
+ /// An [`EntityCommand`] can return a [`Result`](crate::result::Result),
1161
+ /// which will be passed to an error handler if the `Result` is an error.
1162
+ ///
1163
+ /// Error handlers are functions/closures of the form `fn(&mut World, Error)`.
1164
+ /// They are granted exclusive access to the [`World`], which enables them to
1165
+ /// respond to the error in whatever way is necessary.
1154
1166
///
1155
- /// The default error handler panics. It can be configured by enabling the `configurable_error_handler`
1156
- /// cargo feature, then setting the `GLOBAL_ERROR_HANDLER`.
1167
+ /// The [default error handler](error_handler::default) panics.
1168
+ /// It can be configured by enabling the `configurable_error_handler` cargo feature,
1169
+ /// then setting the `GLOBAL_ERROR_HANDLER`.
1157
1170
///
1158
- /// Alternatively, you can customize the error handler for a specific command by calling [`EntityCommands::queue_handled`].
1171
+ /// Alternatively, you can customize the error handler for a specific command
1172
+ /// by calling [`EntityCommands::queue_handled`].
1159
1173
///
1160
1174
/// The [`error_handler`] module provides some simple error handlers for convenience.
1161
1175
pub struct EntityCommands < ' a > {
@@ -1754,7 +1768,8 @@ impl<'a> EntityCommands<'a> {
1754
1768
1755
1769
/// Pushes an [`EntityCommand`] to the queue, which will get executed for the current [`Entity`].
1756
1770
///
1757
- /// If the [`EntityCommand`] returns a [`Result`], it will be handled using the [default error handler](error_handler::default).
1771
+ /// If the [`EntityCommand`] returns a [`Result`],
1772
+ /// it will be handled using the [default error handler](error_handler::default).
1758
1773
///
1759
1774
/// To use a custom error handler, see [`EntityCommands::queue_handled`].
1760
1775
///
@@ -1788,7 +1803,9 @@ impl<'a> EntityCommands<'a> {
1788
1803
}
1789
1804
1790
1805
/// Pushes an [`EntityCommand`] to the queue, which will get executed for the current [`Entity`].
1791
- /// If the command returns a [`Result`] the given `error_handler` will be used to handle error cases.
1806
+ ///
1807
+ /// If the [`EntityCommand`] returns a [`Result`],
1808
+ /// the given `error_handler` will be used to handle error cases.
1792
1809
///
1793
1810
/// To implicitly use the default error handler, see [`EntityCommands::queue`].
1794
1811
///
0 commit comments