summaryrefslogtreecommitdiffstats
path: root/src/settings.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-06-19 01:53:40 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-06-19 01:53:40 +0200
commit341c9a3c12aa9d327ef1d8f168ea0adb9b5ad10b (patch)
tree6a37f29352b1768911b6d42c220f22ebecc202ee /src/settings.rs
parent368b15f70896b387ae3f072e807b289b36b2d103 (diff)
downloadiced-341c9a3c12aa9d327ef1d8f168ea0adb9b5ad10b.tar.gz
iced-341c9a3c12aa9d327ef1d8f168ea0adb9b5ad10b.tar.bz2
iced-341c9a3c12aa9d327ef1d8f168ea0adb9b5ad10b.zip
Introduce `daemon` API and unify shell runtimes
Diffstat (limited to '')
-rw-r--r--src/settings.rs49
1 files changed, 5 insertions, 44 deletions
diff --git a/src/settings.rs b/src/settings.rs
index f7947841..ebac7a86 100644
--- a/src/settings.rs
+++ b/src/settings.rs
@@ -1,30 +1,17 @@
//! Configure your application.
-use crate::window;
use crate::{Font, Pixels};
use std::borrow::Cow;
-/// The settings of an iced [`Program`].
-///
-/// [`Program`]: crate::Program
+/// The settings of an iced program.
#[derive(Debug, Clone)]
-pub struct Settings<Flags = ()> {
+pub struct Settings {
/// The identifier of the application.
///
/// If provided, this identifier may be used to identify the application or
/// communicate with it through the windowing system.
pub id: Option<String>,
- /// The window settings.
- ///
- /// They will be ignored on the Web.
- pub window: window::Settings,
-
- /// The data needed to initialize the [`Program`].
- ///
- /// [`Program`]: crate::Program
- pub flags: Flags,
-
/// The fonts to load on boot.
pub fonts: Vec<Cow<'static, [u8]>>,
@@ -50,34 +37,10 @@ pub struct Settings<Flags = ()> {
pub antialiasing: bool,
}
-impl<Flags> Settings<Flags> {
- /// Initialize [`Program`] settings using the given data.
- ///
- /// [`Program`]: crate::Program
- pub fn with_flags(flags: Flags) -> Self {
- let default_settings = Settings::<()>::default();
-
- Self {
- flags,
- id: default_settings.id,
- window: default_settings.window,
- fonts: default_settings.fonts,
- default_font: default_settings.default_font,
- default_text_size: default_settings.default_text_size,
- antialiasing: default_settings.antialiasing,
- }
- }
-}
-
-impl<Flags> Default for Settings<Flags>
-where
- Flags: Default,
-{
+impl Default for Settings {
fn default() -> Self {
Self {
id: None,
- window: window::Settings::default(),
- flags: Default::default(),
fonts: Vec::new(),
default_font: Font::default(),
default_text_size: Pixels(16.0),
@@ -86,12 +49,10 @@ where
}
}
-impl<Flags> From<Settings<Flags>> for iced_winit::Settings<Flags> {
- fn from(settings: Settings<Flags>) -> iced_winit::Settings<Flags> {
+impl From<Settings> for iced_winit::Settings {
+ fn from(settings: Settings) -> iced_winit::Settings {
iced_winit::Settings {
id: settings.id,
- window: settings.window,
- flags: settings.flags,
fonts: settings.fonts,
}
}