App

Struct App 

Source
pub struct App { /* private fields */ }

Implementations§

Source§

impl App

Source

pub const DEFAULT_EVENT_CAPACITY: usize = 32usize

Default channel capacity for event buses.

Source

pub fn new() -> Self

Examples found in repository?
examples/hello_world.rs (line 10)
9async fn main() {
10    let mut app = App::new();
11    app.add_system(Schedule::Run, hello_world);
12    app.run().await;
13}
Source

pub fn shutdown(&mut self) -> ShutdownConfigBuilder<'_>

Configure shutdown behavior

Source

pub fn service_defaults(&mut self) -> ServiceConfigBuilder<'_>

Configure default settings for all services

Source

pub fn system_defaults(&mut self) -> SystemConfigBuilder<'_>

Configure default settings for all systems

Source

pub fn event_defaults(&mut self) -> EventConfigBuilder<'_>

Configure default settings for all events

Source

pub fn extract<T: FromApp>(&self) -> T

Extract a dependency from the App (convenience helper for Service::create)

Source

pub fn add_module<M: Module>(&mut self, module: M) -> &mut Self

Source

pub fn add_resource<T: Send + Sync + 'static>( &mut self, resource: T, ) -> &mut Self

Source

pub fn add_resources<T: AddResources>(&mut self, resources: T) -> &mut Self

Source

pub fn add_event<E: Clone + Send + 'static>(&mut self) -> EventConfigBuilder<'_>

Source

pub fn add_events<T: AddEvents>(&mut self) -> &mut Self

Source

pub fn event<E: Clone + Send + 'static>(&mut self) -> EventConfigBuilder<'_>

Source

pub fn add_service<S: Service>(&mut self) -> ServiceConfigBuilder<'_>

Source

pub fn add_services<T: AddServices>(&mut self) -> &mut Self

Source

pub fn service<S: Service>(&mut self) -> ServiceConfigBuilder<'_>

Source

pub fn add_system<F, Args>( &mut self, schedule: Schedule, system: F, ) -> SystemConfigBuilder<'_>
where F: IntoSystem<Args>,

Add a single system with the given schedule

Examples found in repository?
examples/hello_world.rs (line 11)
9async fn main() {
10    let mut app = App::new();
11    app.add_system(Schedule::Run, hello_world);
12    app.run().await;
13}
Source

pub fn add_systems<M, S>(&mut self, schedule: Schedule, systems: S) -> &mut Self
where S: IntoSystemConfigs<M>,

Add multiple systems with the given schedule: add_systems(Schedule::Run, (sys1, sys2, sys3))

Source

pub fn system<F, Args>(&mut self, _system: F) -> SystemConfigBuilder<'_>
where F: IntoSystem<Args>,

Configure a previously registered system

Source

pub async fn run(self)

Run the application until shutdown

Examples found in repository?
examples/hello_world.rs (line 12)
9async fn main() {
10    let mut app = App::new();
11    app.add_system(Schedule::Run, hello_world);
12    app.run().await;
13}

Trait Implementations§

Source§

impl Default for App

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for App

§

impl !RefUnwindSafe for App

§

impl Send for App

§

impl !Sync for App

§

impl Unpin for App

§

impl !UnwindSafe for App

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more