pub struct APP;
Expand description
Start and manage an app process.
Implementations§
source§impl APP
impl APP
sourcepub fn defaults(&self) -> AppExtended<Vec<Box<dyn AppExtensionBoxed>>>
pub fn defaults(&self) -> AppExtended<Vec<Box<dyn AppExtensionBoxed>>>
App with default extensions.
§Extensions
Extensions included.
FsWatcherManager
ConfigManager
L10nManager
PointerCaptureManager
MouseManager
TouchManager
KeyboardManager
GestureManager
WindowManager
FontManager
FocusManager
ImageManager
ClipboardManager
UndoManager
SingleInstanceManager
if the"single_instance"
feature is enabled.HotReloadManager
if the"hot_reload"
feature is enabled.MaterialIconsManager
if any"material_icons*"
feature is enabled.SvgManager
if the"svg"
feature is enabled.
Methods from Deref<Target = 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.
sourcepub fn minimal(&self) -> AppExtended<Vec<Box<dyn AppExtensionBoxed>>>
pub fn minimal(&self) -> AppExtended<Vec<Box<dyn AppExtensionBoxed>>>
Starts building an application with no extensions.
sourcepub fn exit(
&self,
) -> ReadOnlyVar<Response<ExitCancelled>, ArcVar<Response<ExitCancelled>>>
pub fn exit( &self, ) -> ReadOnlyVar<Response<ExitCancelled>, ArcVar<Response<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) -> ReadOnlyVar<bool, ArcVar<bool>>
pub fn is_suspended(&self) -> ReadOnlyVar<bool, ArcVar<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.
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.
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 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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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
.§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
.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for 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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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