Skip to content

Commit

Permalink
better doc
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Jul 27, 2021
1 parent 7bdc067 commit 07da3b6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions crates/bevy_ecs/src/system/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,23 @@ impl<'a> Commands<'a> {
}

/// Run a one-off [`System`].
///
/// ```
/// # use bevy_ecs::prelude::*;
/// # struct MyComponent;
///
/// # fn my_system(_components: Query<&MyComponent>) {}
///
/// # fn main_system(mut commands: Commands) {
/// // Can take a standard system function
/// commands.run_system(my_system);
/// // Can take a closure system
/// commands.run_system(|query: Query<&MyComponent>| {
/// println!("count: {}", query.iter().len());
/// });
/// # }
/// # main_system.system();
/// ```
pub fn run_system<Params>(&mut self, system: impl IntoSystem<(), (), Params>) {
self.queue.push(RunSystem {
system: Box::new(system.system()),
Expand Down

0 comments on commit 07da3b6

Please sign in to comment.