pub struct App { /* private fields */ }Expand description
The main application container for ECS-based games.
App holds a World and a set of SystemStages organized by
CoreStage. Systems are added to stages and executed in stage order.
§Stage Execution Order
Stages run in CoreStage order: PreUpdate, Update, PostUpdate,
PreRender, Render, PostRender.
Implementations§
Source§impl App
impl App
Sourcepub fn new_with_defaults() -> Self
pub fn new_with_defaults() -> Self
Creates a new App with default stages and all DefaultPlugins applied.
Sourcepub fn add_plugin<P: Plugin>(&mut self, plugin: P) -> &mut Self
pub fn add_plugin<P: Plugin>(&mut self, plugin: P) -> &mut Self
Adds a plugin to the app.
Each plugin type can only be added once. Duplicate additions are silently ignored.
§Panics
Panics if the plugin declares dependencies that have not been added.
Sourcepub fn add_plugin_group<G: PluginGroup>(&mut self, group: G) -> &mut Self
pub fn add_plugin_group<G: PluginGroup>(&mut self, group: G) -> &mut Self
Adds a plugin group to the app.
Sourcepub fn insert_non_send_resource<T: NonSendResource>(
&mut self,
resource: T,
) -> &mut Self
pub fn insert_non_send_resource<T: NonSendResource>( &mut self, resource: T, ) -> &mut Self
Inserts a non-send resource into the world.
Sourcepub fn add_system<S, Marker>(
&mut self,
stage: CoreStage,
system: S,
) -> &mut Selfwhere
S: IntoSystem<Marker>,
pub fn add_system<S, Marker>(
&mut self,
stage: CoreStage,
system: S,
) -> &mut Selfwhere
S: IntoSystem<Marker>,
Adds a system to the specified stage.
Sourcepub fn insert_resource<R: Resource>(&mut self, resource: R) -> &mut Self
pub fn insert_resource<R: Resource>(&mut self, resource: R) -> &mut Self
Inserts a resource into the world.
Sourcepub fn run_once(&mut self)
pub fn run_once(&mut self)
Executes all stages once in order.
This runs every stage’s systems on the world, from PreUpdate through PostRender.
Sourcepub fn update(&mut self)
pub fn update(&mut self)
Executes all stages once, designed for per-frame use.
Currently identical to run_once. In the future,
this may include frame-specific logic such as delta time updates.
Sourcepub fn register_set(&mut self, stage: CoreStage, name: &str) -> &mut Self
pub fn register_set(&mut self, stage: CoreStage, name: &str) -> &mut Self
Registers a named system set in the specified stage.
Sourcepub fn add_system_to_set<S, Marker>(
&mut self,
stage: CoreStage,
set_name: &str,
system: S,
) -> &mut Selfwhere
S: IntoSystem<Marker>,
pub fn add_system_to_set<S, Marker>(
&mut self,
stage: CoreStage,
set_name: &str,
system: S,
) -> &mut Selfwhere
S: IntoSystem<Marker>,
Adds a system to a named set, returning its [SystemId].
The system is added to the stage and simultaneously placed in the named set.
Sourcepub fn configure_set(
&mut self,
stage: CoreStage,
name: &str,
config: SystemSetConfig,
) -> &mut Self
pub fn configure_set( &mut self, stage: CoreStage, name: &str, config: SystemSetConfig, ) -> &mut Self
Configures ordering for a named set in the specified stage.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for App
impl !RefUnwindSafe for App
impl !Send for App
impl !Sync for App
impl Unpin for App
impl UnsafeUnpin for App
impl !UnwindSafe for App
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().