Fix formatting, spelling, phrasing and consistency (#4275)

# Objective

The `bevy_app` crate has a lot of inconsistencies in the documentation (formatting, spelling, phrasing, consistency).

## Solution

Make it more consistent.
This commit is contained in:
KDecay 2022-04-05 22:36:02 +00:00
parent 30878e3a7d
commit f907d67d7e
6 changed files with 151 additions and 127 deletions

View file

@ -18,20 +18,21 @@ use bevy_utils::tracing::info_span;
bevy_utils::define_label!(AppLabel);
#[allow(clippy::needless_doctest_main)]
/// Containers of app logic and data
/// A container of app logic and data.
///
/// Bundles together the necessary elements, like [`World`] and [`Schedule`], to create
/// an ECS-based application. It also stores a pointer to a
/// [runner function](Self::set_runner). The runner is responsible for managing the application's
/// event loop and applying the [`Schedule`] to the [`World`] to drive application logic.
/// Apps are constructed with the builder pattern.
/// Bundles together the necessary elements like [`World`] and [`Schedule`] to create
/// an ECS-based application. It also stores a pointer to a [runner function](Self::set_runner).
/// The runner is responsible for managing the application's event loop and applying the
/// [`Schedule`] to the [`World`] to drive application logic.
///
/// # Examples
///
/// ## Example
/// Here is a simple "Hello World" Bevy app:
///
/// ```
/// # use bevy_app::prelude::*;
/// # use bevy_ecs::prelude::*;
///
/// #
/// fn main() {
/// App::new()
/// .add_system(hello_world_system)
@ -46,7 +47,7 @@ pub struct App {
/// The main ECS [`World`] of the [`App`].
/// This stores and provides access to all the main data of the application.
/// The systems of the [`App`] will run using this [`World`].
/// If additional separate [`World`]-[`Schedule`] pairs are needed, you can use [`sub_app`][App::add_sub_app]s.
/// If additional separate [`World`]-[`Schedule`] pairs are needed, you can use [`sub_app`](App::add_sub_app)s.
pub world: World,
/// The [runner function](Self::set_runner) is primarily responsible for managing
/// the application's event loop and advancing the [`Schedule`].
@ -58,7 +59,7 @@ pub struct App {
sub_apps: HashMap<Box<dyn AppLabel>, SubApp>,
}
/// Each [`SubApp`] has its own [`Schedule`] and [`World`], enabling a separation of concerns.
/// Each `SubApp` has its own [`Schedule`] and [`World`], enabling a separation of concerns.
struct SubApp {
app: App,
runner: Box<dyn Fn(&mut World, &mut App)>,
@ -104,9 +105,9 @@ impl App {
/// Advances the execution of the [`Schedule`] by one cycle.
///
/// This method also updates sub apps. See [`add_sub_app`](Self::add_sub_app) for more details.
/// This method also updates sub apps.
///
/// See [`Schedule::run_once`] for more details.
/// See [`add_sub_app`](Self::add_sub_app) and [`run_once`](Schedule::run_once) for more details.
pub fn update(&mut self) {
#[cfg(feature = "trace")]
let _bevy_frame_update_span = info_span!("frame").entered();
@ -132,7 +133,7 @@ impl App {
/// Adds a [`Stage`] with the given `label` to the last position of the app's
/// [`Schedule`].
///
/// # Example
/// # Examples
///
/// ```
/// # use bevy_app::prelude::*;
@ -149,7 +150,7 @@ impl App {
/// Adds a [`Stage`] with the given `label` to the app's [`Schedule`], located
/// immediately after the stage labeled by `target`.
///
/// # Example
/// # Examples
///
/// ```
/// # use bevy_app::prelude::*;
@ -171,7 +172,7 @@ impl App {
/// Adds a [`Stage`] with the given `label` to the app's [`Schedule`], located
/// immediately before the stage labeled by `target`.
///
/// # Example
/// # Examples
///
/// ```
/// # use bevy_app::prelude::*;
@ -193,7 +194,7 @@ impl App {
/// Adds a [`Stage`] with the given `label` to the last position of the
/// [startup schedule](Self::add_default_stages).
///
/// # Example
/// # Examples
///
/// ```
/// # use bevy_app::prelude::*;
@ -215,7 +216,7 @@ impl App {
///
/// The `target` label must refer to a stage inside the startup schedule.
///
/// # Example
/// # Examples
///
/// ```
/// # use bevy_app::prelude::*;
@ -246,7 +247,7 @@ impl App {
///
/// The `target` label must refer to a stage inside the startup schedule.
///
/// # Example
/// # Examples
///
/// ```
/// # use bevy_app::prelude::*;
@ -279,9 +280,9 @@ impl App {
/// to a struct implementing `Stage` and returns the same type. That means that it should
/// also assume that the stage has already been fetched successfully.
///
/// See [`Schedule::stage`] for more details.
/// See [`stage`](Schedule::stage) for more details.
///
/// # Example
/// # Examples
///
/// Here the closure is used to add a system to the update stage:
///
@ -310,7 +311,7 @@ impl App {
/// Refer to the [system module documentation](bevy_ecs::system) to see how a system
/// can be defined.
///
/// # Example
/// # Examples
///
/// ```
/// # use bevy_app::prelude::*;
@ -327,7 +328,7 @@ impl App {
/// Adds a [`SystemSet`] to the [update stage](Self::add_default_stages).
///
/// # Example
/// # Examples
///
/// ```
/// # use bevy_app::prelude::*;
@ -351,7 +352,7 @@ impl App {
/// Adds a system to the [`Stage`] identified by `stage_label`.
///
/// # Example
/// # Examples
///
/// ```
/// # use bevy_app::prelude::*;
@ -378,7 +379,7 @@ impl App {
/// Adds a [`SystemSet`] to the [`Stage`] identified by `stage_label`.
///
/// # Example
/// # Examples
///
/// ```
/// # use bevy_app::prelude::*;
@ -414,10 +415,11 @@ impl App {
/// Adds a system to the [startup stage](Self::add_default_stages) of the app's [`Schedule`].
///
/// * For adding a system that runs for every frame, see [`add_system`](Self::add_system).
/// * For adding a system to specific stage, see [`add_system_to_stage`](Self::add_system_to_stage).
/// * For adding a system that runs every frame, see [`add_system`](Self::add_system).
/// * For adding a system to a specific stage, see [`add_system_to_stage`](Self::add_system_to_stage).
///
/// # Examples
///
/// ## Example
/// ```
/// # use bevy_app::prelude::*;
/// # use bevy_ecs::prelude::*;
@ -436,9 +438,9 @@ impl App {
self.add_startup_system_to_stage(StartupStage::Startup, system)
}
/// Adds a [`SystemSet`] to the [startup stage](Self::add_default_stages)
/// Adds a [`SystemSet`] to the [startup stage](Self::add_default_stages).
///
/// # Example
/// # Examples
///
/// ```
/// # use bevy_app::prelude::*;
@ -465,7 +467,7 @@ impl App {
///
/// `stage_label` must refer to a stage inside the startup schedule.
///
/// # Example
/// # Examples
///
/// ```
/// # use bevy_app::prelude::*;
@ -493,7 +495,7 @@ impl App {
///
/// `stage_label` must refer to a stage inside the startup schedule.
///
/// # Example
/// # Examples
///
/// ```
/// # use bevy_app::prelude::*;
@ -560,6 +562,7 @@ impl App {
///
/// All the added stages, with the exception of the startup stage, run every time the
/// schedule is invoked. The stages are the following, in order of execution:
///
/// - **First:** Runs at the very start of the schedule execution cycle, even before the
/// startup stage.
/// - **Startup:** This is actually a schedule containing sub-stages. Runs only once
@ -574,10 +577,9 @@ impl App {
/// world changes that happened during the update stage.
/// - **Last:** Runs right before the end of the schedule execution cycle.
///
/// The labels for those stages are defined in the [`CoreStage`] and [`StartupStage`]
/// `enum`s.
/// The labels for those stages are defined in the [`CoreStage`] and [`StartupStage`] `enum`s.
///
/// # Example
/// # Examples
///
/// ```
/// # use bevy_app::prelude::*;
@ -602,12 +604,12 @@ impl App {
/// Setup the application to manage events of type `T`.
///
/// This is done by adding a `Resource` of type `Events::<T>`,
/// and inserting a `Events::<T>::update_system` system into `CoreStage::First`.
/// This is done by adding a [`Resource`] of type [`Events::<T>`],
/// and inserting an [`update_system`](Events::update_system) into [`CoreStage::First`].
///
/// See [`Events`](bevy_ecs::event::Events) for defining events.
/// See [`Events`] for defining events.
///
/// # Example
/// # Examples
///
/// ```
/// # use bevy_app::prelude::*;
@ -629,14 +631,15 @@ impl App {
self
}
/// Inserts a resource to the current [App] and overwrites any resource previously added of the same type.
/// Inserts a [`Resource`] to the current [`App`] and overwrites any [`Resource`] previously added of the same type.
///
/// A resource in Bevy represents globally unique data. Resources must be added to Bevy Apps
/// A [`Resource`] in Bevy represents globally unique data. [`Resource`]s must be added to Bevy apps
/// before using them. This happens with [`insert_resource`](Self::insert_resource).
///
/// See also `init_resource` for resources that implement `Default` or [`FromWorld`].
/// See [`init_resource`](Self::init_resource) for [`Resource`]s that implement [`Default`] or [`FromWorld`].
///
/// # Examples
///
/// ## Example
/// ```
/// # use bevy_app::prelude::*;
/// #
@ -652,12 +655,13 @@ impl App {
self
}
/// Inserts a non-send resource to the app
/// Inserts a non-send [`Resource`] to the app.
///
/// You usually want to use `insert_resource`,
/// but there are some special cases when a resource cannot be sent across threads.
/// You usually want to use [`insert_resource`](Self::insert_resource),
/// but there are some special cases when a [`Resource`] cannot be sent across threads.
///
/// # Examples
///
/// ## Example
/// ```
/// # use bevy_app::prelude::*;
/// #
@ -673,15 +677,16 @@ impl App {
self
}
/// Initialize a resource with standard starting values by adding it to the [`World`]
/// Initialize a [`Resource`] with standard starting values by adding it to the [`World`].
///
/// If the resource already exists, nothing happens.
/// If the [`Resource`] already exists, nothing happens.
///
/// The resource must implement the [`FromWorld`] trait.
/// If the `Default` trait is implemented, the `FromWorld` trait will use
/// the `Default::default` method to initialize the resource.
/// The [`Resource`] must implement the [`FromWorld`] trait.
/// If the [`Default`] trait is implemented, the [`FromWorld`] trait will use
/// the [`Default::default`] method to initialize the [`Resource`].
///
/// # Examples
///
/// ## Example
/// ```
/// # use bevy_app::prelude::*;
/// #
@ -705,11 +710,11 @@ impl App {
self
}
/// Initialize a non-send resource with standard starting values by adding it to the [`World`]
/// Initialize a non-send [`Resource`] with standard starting values by adding it to the [`World`].
///
/// The resource must implement the [`FromWorld`] trait.
/// If the `Default` trait is implemented, the `FromWorld` trait will use
/// the `Default::default` method to initialize the resource.
/// The [`Resource`] must implement the [`FromWorld`] trait.
/// If the [`Default`] trait is implemented, the [`FromWorld`] trait will use
/// the [`Default::default`] method to initialize the [`Resource`].
pub fn init_non_send_resource<R: 'static + FromWorld>(&mut self) -> &mut Self {
self.world.init_non_send_resource::<R>();
self
@ -717,14 +722,15 @@ impl App {
/// Sets the function that will be called when the app is run.
///
/// The runner function (`run_fn`) is called only once by [`App::run`]. If the
/// presence of a main loop in the app is desired, it is responsibility of the runner
/// The runner function `run_fn` is called only once by [`App::run`]. If the
/// presence of a main loop in the app is desired, it is the responsibility of the runner
/// function to provide it.
///
/// The runner function is usually not set manually, but by Bevy integrated plugins
/// (e.g. winit plugin).
/// (e.g. `WinitPlugin`).
///
/// # Examples
///
/// ## Example
/// ```
/// # use bevy_app::prelude::*;
/// #
@ -743,14 +749,15 @@ impl App {
self
}
/// Adds a single plugin
/// Adds a single [`Plugin`].
///
/// One of Bevy's core principles is modularity. All Bevy engine features are implemented
/// as plugins. This includes internal features like the renderer.
/// as [`Plugin`]s. This includes internal features like the renderer.
///
/// Bevy also provides a few sets of default plugins. See [`add_plugins`](Self::add_plugins).
/// Bevy also provides a few sets of default [`Plugin`]s. See [`add_plugins`](Self::add_plugins).
///
/// # Examples
///
/// ## Example
/// ```
/// # use bevy_app::prelude::*;
/// #
@ -765,14 +772,15 @@ impl App {
self
}
/// Adds a group of plugins
/// Adds a group of [`Plugin`]s.
///
/// Bevy plugins can be grouped into a set of plugins. Bevy provides
/// built-in `PluginGroups` that provide core engine functionality.
/// [`Plugin`]s can be grouped into a set by using a [`PluginGroup`].
///
/// The plugin groups available by default are `DefaultPlugins` and `MinimalPlugins`.
/// There are built-in [`PluginGroup`]s that provide core engine functionality.
/// The [`PluginGroup`]s available by default are `DefaultPlugins` and `MinimalPlugins`.
///
/// # Examples
///
/// ## Example
/// ```
/// # use bevy_app::{prelude::*, PluginGroupBuilder};
/// #
@ -792,18 +800,19 @@ impl App {
self
}
/// Adds a group of plugins with an initializer method
/// Adds a group of [`Plugin`]s with an initializer method.
///
/// Can be used to add a group of plugins, where the group is modified
/// before insertion into Bevy application. For example, you can add
/// extra plugins at a specific place in the plugin group, or deactivate
/// specific plugins while keeping the rest.
/// Can be used to add a group of [`Plugin`]s, where the group is modified
/// before insertion into a Bevy application. For example, you can add
/// additional [`Plugin`]s at a specific place in the [`PluginGroup`], or deactivate
/// specific [`Plugin`]s while keeping the rest.
///
/// # Examples
///
/// ## Example
/// ```
/// # use bevy_app::{prelude::*, PluginGroupBuilder};
/// #
/// # // Dummies created to avoid using bevy_internal which pulls in to many dependencies.
/// # // Dummies created to avoid using bevy_internal which pulls in too many dependencies.
/// # struct DefaultPlugins;
/// # impl PluginGroup for DefaultPlugins {
/// # fn build(&mut self, group: &mut PluginGroupBuilder){
@ -833,7 +842,7 @@ impl App {
self
}
/// Adds the type `T` to the type registry resource.
/// Adds the type `T` to the type registry [`Resource`].
#[cfg(feature = "bevy_reflect")]
pub fn register_type<T: bevy_reflect::GetTypeRegistration>(&mut self) -> &mut Self {
{
@ -843,11 +852,11 @@ impl App {
self
}
/// Adds an `App` as a child of the current one.
/// Adds an [`App`] as a child of the current one.
///
/// The provided function `f` is called by the [`update`](Self::update) method. The `World`
/// parameter represents the main app world, while the `App` parameter is just a mutable
/// reference to the sub app itself.
/// The provided function `f` is called by the [`update`](Self::update) method. The [`World`]
/// parameter represents the main app world, while the [`App`] parameter is just a mutable
/// reference to the `SubApp` itself.
pub fn add_sub_app(
&mut self,
label: impl AppLabel,
@ -864,7 +873,11 @@ impl App {
self
}
/// Retrieves a "sub app" stored inside this [App]. This will panic if the sub app does not exist.
/// Retrieves a `SubApp` stored inside this [`App`].
///
/// # Panics
///
/// Panics if the `SubApp` doesn't exist.
pub fn sub_app_mut(&mut self, label: impl AppLabel) -> &mut App {
match self.get_sub_app_mut(label) {
Ok(app) => app,
@ -872,8 +885,8 @@ impl App {
}
}
/// Retrieves a "sub app" inside this [App] with the given label, if it exists. Otherwise returns
/// an [Err] containing the given label.
/// Retrieves a `SubApp` inside this [`App`] with the given label, if it exists. Otherwise returns
/// an [`Err`] containing the given label.
pub fn get_sub_app_mut(&mut self, label: impl AppLabel) -> Result<&mut App, impl AppLabel> {
self.sub_apps
.get_mut((&label) as &dyn AppLabel)
@ -881,7 +894,11 @@ impl App {
.ok_or(label)
}
/// Retrieves a "sub app" stored inside this [App]. This will panic if the sub app does not exist.
/// Retrieves a `SubApp` stored inside this [`App`].
///
/// # Panics
///
/// Panics if the `SubApp` doesn't exist.
pub fn sub_app(&self, label: impl AppLabel) -> &App {
match self.get_sub_app(label) {
Ok(app) => app,
@ -889,8 +906,8 @@ impl App {
}
}
/// Retrieves a "sub app" inside this [App] with the given label, if it exists. Otherwise returns
/// an [Err] containing the given label.
/// Retrieves a `SubApp` inside this [`App`] with the given label, if it exists. Otherwise returns
/// an [`Err`] containing the given label.
pub fn get_sub_app(&self, label: impl AppLabel) -> Result<&App, impl AppLabel> {
self.sub_apps
.get((&label) as &dyn AppLabel)
@ -903,6 +920,6 @@ fn run_once(mut app: App) {
app.update();
}
/// An event that indicates the app should exit. This will fully exit the app process.
/// An event that indicates the [`App`] should exit. This will fully exit the app process.
#[derive(Debug, Clone, Default)]
pub struct AppExit;

View file

@ -1,11 +1,14 @@
use crate::{app::AppExit, App};
use serde::Deserialize;
use crate::{app::AppExit, App};
/// Configuration for automated testing on CI
/// A configuration struct for automated CI testing.
///
/// It gets used when the `bevy_ci_testing` feature is enabled to automatically
/// exit a Bevy app when run through the CI. This is needed because otherwise
/// Bevy apps would be stuck in the game loop and wouldn't allow the CI to progress.
#[derive(Deserialize)]
pub struct CiTestingConfig {
/// Number of frames after wich Bevy should exit
/// The number of frames after which Bevy should exit.
pub exit_after: Option<u32>,
}

View file

@ -1,6 +1,6 @@
//! This crate is about everything concerning the highest-level, application layer of a Bevy app.
#![warn(missing_docs)]
//! This crate is about everything concerning the highest-level, application layer of a Bevy
//! app.
mod app;
mod plugin;
@ -26,39 +26,38 @@ pub mod prelude {
use bevy_ecs::schedule::StageLabel;
/// The names of the default App stages
/// The names of the default [`App`] stages.
///
/// The relative stages are added by [`App::add_default_stages`].
/// The relative [`Stages`](bevy_ecs::schedule::Stage) are added by [`App::add_default_stages`].
#[derive(Debug, Hash, PartialEq, Eq, Clone, StageLabel)]
pub enum CoreStage {
/// Name of app stage that runs before all other app stages
/// The [`Stage`](bevy_ecs::schedule::Stage) that runs before all other app stages.
First,
/// Name of app stage responsible for performing setup before an update. Runs before UPDATE.
/// The [`Stage`](bevy_ecs::schedule::Stage) that runs before [`CoreStage::Update`].
PreUpdate,
/// Name of app stage responsible for doing most app logic. Systems should be registered here
/// by default.
/// The [`Stage`](bevy_ecs::schedule::Stage) responsible for doing most app logic. Systems should be registered here by default.
Update,
/// Name of app stage responsible for processing the results of UPDATE. Runs after UPDATE.
/// The [`Stage`](bevy_ecs::schedule::Stage) that runs after [`CoreStage::Update`].
PostUpdate,
/// Name of app stage that runs after all other app stages
/// The [`Stage`](bevy_ecs::schedule::Stage) that runs after all other app stages.
Last,
}
/// The label for the Startup [`Schedule`](bevy_ecs::schedule::Schedule),
/// which runs once at the beginning of the app.
/// The label for the startup [`Schedule`](bevy_ecs::schedule::Schedule),
/// which runs once at the beginning of the [`App`].
///
/// When targeting a [`Stage`](bevy_ecs::schedule::Stage) inside this Schedule,
/// When targeting a [`Stage`](bevy_ecs::schedule::Stage) inside this [`Schedule`](bevy_ecs::schedule::Schedule),
/// you need to use [`StartupStage`] instead.
#[derive(Debug, Hash, PartialEq, Eq, Clone, StageLabel)]
pub struct StartupSchedule;
/// The names of the default App startup stages
/// The names of the default [`App`] startup stages.
#[derive(Debug, Hash, PartialEq, Eq, Clone, StageLabel)]
pub enum StartupStage {
/// Name of app stage that runs once before the startup stage
/// The [`Stage`](bevy_ecs::schedule::Stage) that runs once before [`StartupStage::Startup`].
PreStartup,
/// Name of app stage that runs once when an app starts up
/// The [`Stage`](bevy_ecs::schedule::Stage) that runs once when an [`App`] starts up.
Startup,
/// Name of app stage that runs once after the startup stage
/// The [`Stage`](bevy_ecs::schedule::Stage) that runs once after [`StartupStage::Startup`].
PostStartup,
}

View file

@ -1,20 +1,21 @@
use crate::App;
use std::any::Any;
/// A collection of Bevy App logic and configuration
/// A collection of Bevy app logic and configuration.
///
/// Plugins configure an [`App`](crate::App). When an [`App`](crate::App) registers
/// a plugin, the plugin's [`Plugin::build`] function is run.
/// Plugins configure an [`App`]. When an [`App`] registers a plugin,
/// the plugin's [`Plugin::build`] function is run.
pub trait Plugin: Any + Send + Sync {
/// Configures the [`App`] to which this plugin is added.
fn build(&self, app: &mut App);
/// Configures a name for the [`Plugin`]. Primarily for debugging.
/// Configures a name for the [`Plugin`] which is primarily used for debugging.
fn name(&self) -> &str {
std::any::type_name::<Self>()
}
}
/// Type representing an unsafe function that returns a mutable pointer to a [`Plugin`].
/// Used for dynamically loading plugins. See
/// `bevy_dynamic_plugin/src/loader.rs#dynamically_load_plugin`
/// A type representing an unsafe function that returns a mutable pointer to a [`Plugin`].
/// It is used for dynamically loading plugins.
///
/// See `bevy_dynamic_plugin/src/loader.rs#dynamically_load_plugin`.
pub type CreatePlugin = unsafe fn() -> *mut dyn Plugin;

View file

@ -14,7 +14,7 @@ struct PluginEntry {
}
/// Facilitates the creation and configuration of a [`PluginGroup`].
/// Provides a build ordering to ensure that [`Plugin`]s which produce/require a resource
/// Provides a build ordering to ensure that [`Plugin`]s which produce/require a [`Resource`](bevy_ecs::system::Resource)
/// are built before/after dependent/depending [`Plugin`]s.
#[derive(Default)]
pub struct PluginGroupBuilder {
@ -86,7 +86,7 @@ impl PluginGroupBuilder {
self
}
/// Enables a [`Plugin`]
/// Enables a [`Plugin`].
///
/// [`Plugin`]s within a [`PluginGroup`] are enabled by default. This function is used to
/// opt back in to a [`Plugin`] after [disabling](Self::disable) it.
@ -99,7 +99,7 @@ impl PluginGroupBuilder {
self
}
/// Disables a [`Plugin`], preventing it from being added to the `App` with the rest of the [`PluginGroup`].
/// Disables a [`Plugin`], preventing it from being added to the [`App`] with the rest of the [`PluginGroup`].
pub fn disable<T: Plugin>(&mut self) -> &mut Self {
let mut plugin_entry = self
.plugins

View file

@ -10,13 +10,15 @@ use std::{cell::RefCell, rc::Rc};
#[cfg(target_arch = "wasm32")]
use wasm_bindgen::{prelude::*, JsCast};
/// Determines the method used to run an [App]'s [`Schedule`](bevy_ecs::schedule::Schedule).
/// Determines the method used to run an [`App`]'s [`Schedule`](bevy_ecs::schedule::Schedule).
///
/// It is used in the [`ScheduleRunnerSettings`].
#[derive(Copy, Clone, Debug)]
pub enum RunMode {
/// Indicates that the [`App`]'s schedule should run repeatedly.
Loop {
/// Minimum duration to wait after a schedule has completed before repeating.
/// A value of [`None`] will not wait.
/// The minimum [`Duration`] to wait after a [`Schedule`](bevy_ecs::schedule::Schedule)
/// has completed before repeating. A value of [`None`] will not wait.
wait: Option<Duration>,
},
/// Indicates that the [`App`]'s schedule should run only once.
@ -29,7 +31,9 @@ impl Default for RunMode {
}
}
/// Configuration information for [`ScheduleRunnerPlugin`].
/// The configuration information for the [`ScheduleRunnerPlugin`].
///
/// It gets added as a [`Resource`](bevy_ecs::system::Resource) inside of the [`ScheduleRunnerPlugin`].
#[derive(Copy, Clone, Default)]
pub struct ScheduleRunnerSettings {
/// Determines whether the [`Schedule`](bevy_ecs::schedule::Schedule) is run once or repeatedly.
@ -37,14 +41,14 @@ pub struct ScheduleRunnerSettings {
}
impl ScheduleRunnerSettings {
/// [`RunMode::Once`]
/// See [`RunMode::Once`].
pub fn run_once() -> Self {
ScheduleRunnerSettings {
run_mode: RunMode::Once,
}
}
/// [`RunMode::Loop`]
/// See [`RunMode::Loop`].
pub fn run_loop(wait_duration: Duration) -> Self {
ScheduleRunnerSettings {
run_mode: RunMode::Loop {
@ -54,8 +58,8 @@ impl ScheduleRunnerSettings {
}
}
/// Configures an `App` to run its [`Schedule`](bevy_ecs::schedule::Schedule) according to a given
/// [`RunMode`]
/// Configures an [`App`] to run its [`Schedule`](bevy_ecs::schedule::Schedule) according to a given
/// [`RunMode`].
#[derive(Default)]
pub struct ScheduleRunnerPlugin;