pub struct APP;
Expand description
Start and manage an app process.
Implementations§
source§impl APP
impl APP
sourcepub fn exit(&self) -> ResponseVar<ExitCancelled>
pub fn exit(&self) -> ResponseVar<ExitCancelled>
Register a request for process exit with code 0
in the next update.
The EXIT_REQUESTED_EVENT
will notify, and if propagation is not cancelled the app process will exit.
Returns a response variable that is updated once with the unit value ExitCancelled
if the exit operation is cancelled.
See also the EXIT_CMD
.
sourcepub fn is_suspended(&self) -> ReadOnlyArcVar<bool>
pub fn is_suspended(&self) -> ReadOnlyArcVar<bool>
Gets a variable that tracks if the app is suspended by the operating system.
Suspended apps cannot create graphics contexts and are likely to be killed if the user does not return. Operations that persist data should flush on suspension.
App suspension is controlled by the view-process, the VIEW_PROCESS_SUSPENDED_EVENT
notifies
on suspension and the VIEW_PROCESS_INITED_EVENT
notifies a “respawn” on resume.
source§impl APP
impl APP
App time control.
The manual time methods are only recommended for headless apps.
sourcepub fn pause_time_for_update(&self) -> ArcVar<bool>
pub fn pause_time_for_update(&self) -> ArcVar<bool>
Gets a variable that configures if INSTANT.now
is the same exact value during each update, info, layout or render pass.
Time is paused by default, setting this to false
will cause INSTANT.now
to read the system time for every call.
sourcepub fn start_manual_time(&self)
pub fn start_manual_time(&self)
Pause the INSTANT.now
value, after this call it must be updated manually using
advance_manual_time
or set_manual_time
. To resume normal time use end_manual_time
.
sourcepub fn advance_manual_time(&self, advance: Duration)
pub fn advance_manual_time(&self, advance: Duration)
Adds the advance
to the current manual time.
Note that you must ensure an update reaches the code that controls manual time, otherwise the app loop may end-up stuck on idle or awaiting a timer that never elapses.
§Panics
Panics if called before start_manual_time
.
sourcepub fn set_manual_time(&self, now: DInstant)
pub fn set_manual_time(&self, now: DInstant)
sourcepub fn end_manual_time(&self)
pub fn end_manual_time(&self)
Resumes normal time.
source§impl APP
impl APP
sourcepub fn multi_app_enabled(&self) -> bool
pub fn multi_app_enabled(&self) -> bool
If the crate was built with feature="multi_app"
.
If true
multiple apps can run in the same process, but only one app per thread at a time.
sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
If an app is already running in the current thread.
Apps are running as soon as they start building, and stop running after
AppExtended::run
returns or the HeadlessApp
is dropped.
You can use app_local!
to create static resources that live for the app lifetime.
sourcepub fn id(&self) -> Option<AppId>
pub fn id(&self) -> Option<AppId>
Gets the unique ID of the current app.
This ID usually does not change as most apps only run once per process, but it can change often during tests.
Resources that interact with app_local!
values can use this ID to ensure that they are still operating in the same
app.
sourcepub fn window_mode(&self) -> WindowMode
pub fn window_mode(&self) -> WindowMode
Returns a WindowMode
value that indicates if the app is headless, headless with renderer or headed.
Note that specific windows can be in headless mode even if the app is headed.
sourcepub fn extensions(&self) -> Arc<AppExtensionsInfo>
pub fn extensions(&self) -> Arc<AppExtensionsInfo>
List of app extensions that are part of the current app.
sourcepub fn device_events(&self) -> bool
pub fn device_events(&self) -> bool
If device events are enabled for the current app.
See AppExtension::enable_device_events
for more details.
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§
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more