diff options
author | 2024-03-07 20:11:32 +0100 | |
---|---|---|
committer | 2024-03-07 20:11:32 +0100 | |
commit | 833538ee7f3a60a839304762dfc29b0881d19094 (patch) | |
tree | 7afbc69659c95f9cbec58c938f1939cca3290b04 /src/application.rs | |
parent | 44f002f64a9d53040f09affe69bd92675e302e16 (diff) | |
download | iced-833538ee7f3a60a839304762dfc29b0881d19094.tar.gz iced-833538ee7f3a60a839304762dfc29b0881d19094.tar.bz2 iced-833538ee7f3a60a839304762dfc29b0881d19094.zip |
Leverage `DefaultStyle` traits instead of `Default`
Diffstat (limited to '')
-rw-r--r-- | src/application.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/application.rs b/src/application.rs index 3247a97d..a7e4d8da 100644 --- a/src/application.rs +++ b/src/application.rs @@ -3,7 +3,7 @@ use crate::{Command, Element, Executor, Settings, Subscription}; use crate::shell::application; -pub use application::{default, Appearance, Style}; +pub use application::{default, Appearance, DefaultStyle}; /// An interactive cross-platform application. /// @@ -95,7 +95,7 @@ pub use application::{default, Appearance, Style}; /// ``` pub trait Application: Sized where - Style<Self::Theme>: Default, + Self::Theme: DefaultStyle, { /// The [`Executor`] that will run commands and subscriptions. /// @@ -153,11 +153,9 @@ where Self::Theme::default() } - /// Returns the current `Style` of the [`Theme`]. - /// - /// [`Theme`]: Self::Theme + /// Returns the current [`Appearance`] of the [`Application`]. fn style(&self, theme: &Self::Theme) -> Appearance { - Style::default().resolve(theme) + theme.default_style() } /// Returns the event [`Subscription`] for the current state of the @@ -221,12 +219,12 @@ where struct Instance<A>(A) where A: Application, - application::Style<A::Theme>: Default; + A::Theme: DefaultStyle; impl<A> crate::runtime::Program for Instance<A> where A: Application, - application::Style<A::Theme>: Default, + A::Theme: DefaultStyle, { type Message = A::Message; type Theme = A::Theme; @@ -244,7 +242,7 @@ where impl<A> application::Application for Instance<A> where A: Application, - application::Style<A::Theme>: Default, + A::Theme: DefaultStyle, { type Flags = A::Flags; |