From df7877767567cc0c7f48d2d6da4680a55f0f7b6d Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 3 Nov 2022 03:27:55 +0100 Subject: Box `Custom` in `Theme` --- examples/scrollable/src/main.rs | 2 +- examples/styling/src/main.rs | 2 +- style/src/theme.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/scrollable/src/main.rs b/examples/scrollable/src/main.rs index 7e1716cf..6eba34e2 100644 --- a/examples/scrollable/src/main.rs +++ b/examples/scrollable/src/main.rs @@ -205,7 +205,7 @@ impl Application for ScrollableDemo { } fn theme(&self) -> Theme { - self.theme + self.theme.clone() } } diff --git a/examples/styling/src/main.rs b/examples/styling/src/main.rs index 6bcfa5f1..e16860ad 100644 --- a/examples/styling/src/main.rs +++ b/examples/styling/src/main.rs @@ -159,6 +159,6 @@ impl Sandbox for Styling { } fn theme(&self) -> Theme { - self.theme + self.theme.clone() } } diff --git a/style/src/theme.rs b/style/src/theme.rs index 723c60d6..a253e990 100644 --- a/style/src/theme.rs +++ b/style/src/theme.rs @@ -21,19 +21,19 @@ use crate::toggler; use iced_core::{Background, Color}; -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, PartialEq)] pub enum Theme { Light, Dark, - Custom(Custom), + Custom(Box), } impl Theme { pub fn custom(palette: Palette) -> Self { - Self::Custom(Custom::new(palette)) + Self::Custom(Box::new(Custom::new(palette))) } - pub fn palette(self) -> Palette { + pub fn palette(&self) -> Palette { match self { Self::Light => Palette::LIGHT, Self::Dark => Palette::DARK, -- cgit