pub enum AppExit {
Success,
Error(NonZeroU8),
}Expand description
An event that indicates the App should exit. If one or more of these are present at the end of an update,
the runner will end and (maybe) return control to the caller.
This event can be used to detect when an exit is requested. Make sure that systems listening for this event run before the current update ends.
§Portability
This type is roughly meant to map to a standard definition of a process exit code (0 means success, not 0 means error). Due to portability concerns
(see ExitCode and process::exit)
we only allow error codes between 1 and 255.
Variants§
Success
App exited without any problems.
Error(NonZeroU8)
The App experienced an unhandleable error.
Holds the exit code we expect our app to return.
Implementations§
source§impl AppExit
impl AppExit
sourcepub const fn error() -> Self
pub const fn error() -> Self
Creates a AppExit::Error with a error code of 1.
sourcepub const fn is_success(&self) -> bool
pub const fn is_success(&self) -> bool
Returns true if self is a AppExit::Success.
sourcepub const fn is_error(&self) -> bool
pub const fn is_error(&self) -> bool
Returns true if self is a AppExit::Error.
sourcepub const fn from_code(code: u8) -> Self
pub const fn from_code(code: u8) -> Self
Creates a AppExit from a code.
When code is 0 a AppExit::Success is constructed otherwise a
AppExit::Error is constructed.
Trait Implementations§
source§impl Component for AppExit
impl Component for AppExit
source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
source§fn register_component_hooks(_hooks: &mut ComponentHooks)
fn register_component_hooks(_hooks: &mut ComponentHooks)
ComponentHooks.source§impl PartialEq for AppExit
impl PartialEq for AppExit
source§impl Termination for AppExit
impl Termination for AppExit
impl Eq for AppExit
impl Event for AppExit
impl StructuralPartialEq for AppExit
Auto Trait Implementations§
impl Freeze for AppExit
impl RefUnwindSafe for AppExit
impl Send for AppExit
impl Sync for AppExit
impl Unpin for AppExit
impl UnwindSafe for AppExit
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<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId) )
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> C
source§fn get_component_ids(
components: &Components,
ids: &mut impl FnMut(Option<ComponentId>)
)
fn get_component_ids( components: &Components, ids: &mut impl FnMut(Option<ComponentId>) )
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
fn get_components(self, func: &mut impl FnMut(StorageType, OwningPtr<'_>))
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self using data from the given World.