File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
crates/bevy_ecs/src/system/commands Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,23 @@ impl<'a> Commands<'a> {
155155 }
156156
157157 /// Run a one-off [`System`].
158+ ///
159+ /// ```
160+ /// # use bevy_ecs::prelude::*;
161+ /// # struct MyComponent;
162+ ///
163+ /// # fn my_system(_components: Query<&MyComponent>) {}
164+ ///
165+ /// # fn main_system(mut commands: Commands) {
166+ /// // Can take a standard system function
167+ /// commands.run_system(my_system);
168+ /// // Can take a closure system
169+ /// commands.run_system(|query: Query<&MyComponent>| {
170+ /// println!("count: {}", query.iter().len());
171+ /// });
172+ /// # }
173+ /// # main_system.system();
174+ /// ```
158175 pub fn run_system < Params > ( & mut self , system : impl IntoSystem < ( ) , ( ) , Params > ) {
159176 self . queue . push ( RunSystem {
160177 system : Box :: new ( system. system ( ) ) ,
You can’t perform that action at this time.
0 commit comments