summaryrefslogtreecommitdiffstats
path: root/src/application.rs
diff options
context:
space:
mode:
authorLibravatar Kaiden42 <gitlab@tinysn.com>2020-09-09 14:47:36 +0200
committerLibravatar Kaiden42 <gitlab@tinysn.com>2020-09-09 14:47:36 +0200
commit0724fb8ebf7c60b396843d021b949cc9061b4c3e (patch)
treee538d3b83d399acccf62577f4eebc459d44b5ef8 /src/application.rs
parent5bfa4805a944abe82700287f0af0117462d6d21c (diff)
parent49076c6ac2983e2076dae64f68a2e801904d7ce9 (diff)
downloadiced-0724fb8ebf7c60b396843d021b949cc9061b4c3e.tar.gz
iced-0724fb8ebf7c60b396843d021b949cc9061b4c3e.tar.bz2
iced-0724fb8ebf7c60b396843d021b949cc9061b4c3e.zip
Merge branch 'master' from upstream into embedded
Diffstat (limited to 'src/application.rs')
-rw-r--r--src/application.rs22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/application.rs b/src/application.rs
index 47b89dbd..d46cd2ac 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -1,6 +1,5 @@
-use crate::{
- window, Color, Command, Element, Executor, Settings, Subscription,
-};
+use crate::window;
+use crate::{Color, Command, Element, Executor, Settings, Subscription};
/// An interactive cross-platform application.
///
@@ -59,7 +58,7 @@ use crate::{
/// ```no_run
/// use iced::{executor, Application, Command, Element, Settings, Text};
///
-/// pub fn main() {
+/// pub fn main() -> iced::Result {
/// Hello::run(Settings::default())
/// }
///
@@ -204,12 +203,13 @@ pub trait Application: Sized {
/// Runs the [`Application`].
///
/// On native platforms, this method will take control of the current thread
- /// and __will NOT return__.
+ /// and __will NOT return__ unless there is an [`Error`] during startup.
///
/// It should probably be that last thing you call in your `main` function.
///
/// [`Application`]: trait.Application.html
- fn run(settings: Settings<Self::Flags>)
+ /// [`Error`]: enum.Error.html
+ fn run(settings: Settings<Self::Flags>) -> crate::Result
where
Self: 'static,
{
@@ -226,15 +226,19 @@ pub trait Application: Sized {
..crate::renderer::Settings::default()
};
- crate::runtime::application::run::<
+ Ok(crate::runtime::application::run::<
Instance<Self>,
Self::Executor,
crate::renderer::window::Compositor,
- >(settings.into(), renderer_settings);
+ >(settings.into(), renderer_settings)?)
}
#[cfg(target_arch = "wasm32")]
- <Instance<Self> as iced_web::Application>::run(settings.flags);
+ {
+ <Instance<Self> as iced_web::Application>::run(settings.flags);
+
+ Ok(())
+ }
}
}