summaryrefslogtreecommitdiffstats
path: root/src/settings.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-03-30 18:00:15 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-03-30 18:10:15 +0200
commitc4c5216e3b69d732b0518d510f95675a4ba7010b (patch)
tree25e14890319bbab46aeb5133ef1c694959b9f694 /src/settings.rs
parent6e9ab1cd6f5358d323040379e3aadbed2cc4f7f8 (diff)
downloadiced-c4c5216e3b69d732b0518d510f95675a4ba7010b.tar.gz
iced-c4c5216e3b69d732b0518d510f95675a4ba7010b.tar.bz2
iced-c4c5216e3b69d732b0518d510f95675a4ba7010b.zip
Allow passing external state to `Application::new`
Diffstat (limited to 'src/settings.rs')
-rw-r--r--src/settings.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/settings.rs b/src/settings.rs
index 32ec583c..f36ec85f 100644
--- a/src/settings.rs
+++ b/src/settings.rs
@@ -3,7 +3,7 @@ use crate::window;
/// The settings of an application.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
-pub struct Settings {
+pub struct Settings<Flags> {
/// The window settings.
///
/// They will be ignored on the Web.
@@ -11,6 +11,11 @@ pub struct Settings {
/// [`Window`]: struct.Window.html
pub window: window::Settings,
+ /// The data needed to initialize an [`Application`].
+ ///
+ /// [`Application`]: trait.Application.html
+ pub flags: Flags,
+
/// The bytes of the font that will be used by default.
///
/// If `None` is provided, a default system font will be chosen.
@@ -28,8 +33,8 @@ pub struct Settings {
}
#[cfg(not(target_arch = "wasm32"))]
-impl From<Settings> for iced_winit::Settings {
- fn from(settings: Settings) -> iced_winit::Settings {
+impl<Flags> From<Settings<Flags>> for iced_winit::Settings<Flags> {
+ fn from(settings: Settings<Flags>) -> iced_winit::Settings<Flags> {
iced_winit::Settings {
window: iced_winit::settings::Window {
size: settings.window.size,
@@ -37,6 +42,7 @@ impl From<Settings> for iced_winit::Settings {
decorations: settings.window.decorations,
platform_specific: Default::default(),
},
+ flags: settings.flags,
}
}
}