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 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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§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
.