summaryrefslogtreecommitdiffstats
path: root/src/application.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2021-03-31 10:20:22 +0200
committerLibravatar GitHub <noreply@github.com>2021-03-31 10:20:22 +0200
commitb9ec44446ed4d99b9b17aceafdcb353dd1595877 (patch)
tree86b3e4d9a7257a6d5b0d82988111f2a3a5ca7117 /src/application.rs
parentbbb4e4678f14b4b187f9537a32063440e727e919 (diff)
parent8f952452ce3d61203856bcebae7016372556be31 (diff)
downloadiced-b9ec44446ed4d99b9b17aceafdcb353dd1595877.tar.gz
iced-b9ec44446ed4d99b9b17aceafdcb353dd1595877.tar.bz2
iced-b9ec44446ed4d99b9b17aceafdcb353dd1595877.zip
Merge pull request #804 from hecrj/feature/graceful-exit
Graceful exiting for `Application`
Diffstat (limited to '')
-rw-r--r--src/application.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/application.rs b/src/application.rs
index 83ce900a..7b7de6d4 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -184,6 +184,13 @@ pub trait Application: Sized {
1.0
}
+ /// Returns whether the [`Application`] should be terminated.
+ ///
+ /// By default, it returns `false`.
+ fn should_exit(&self) -> bool {
+ false
+ }
+
/// Runs the [`Application`].
///
/// On native platforms, this method will take control of the current thread
@@ -284,6 +291,10 @@ where
fn scale_factor(&self) -> f64 {
self.0.scale_factor()
}
+
+ fn should_exit(&self) -> bool {
+ self.0.should_exit()
+ }
}
#[cfg(target_arch = "wasm32")]