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.
FsWatcherManagerif the"fs_watcher"feature is enabled.ConfigManagerif the"config"feature is enabled.L10nManagerPointerCaptureManagerMouseManagerTouchManagerKeyboardManagerGestureManagerWindowManagerif the"window"feature is enabled.FontManagerFocusManagerDragDropManagerif the"drag_drop"feature is enabled.ImageManagerif the"image"feature is enabled.ClipboardManagerif the"clipboard"feature is enabled.UndoManagerSingleInstanceManagerif the"single_instance"feature is enabled.HotReloadManagerif the"hot_reload"feature is enabled.MaterialIconsManagerif any"material_icons*"feature is enabled.SvgManagerif 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
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<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> 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