summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/styling.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/examples/styling.rs b/examples/styling.rs
index 95590f2c..9f8cc53f 100644
--- a/examples/styling.rs
+++ b/examples/styling.rs
@@ -7,6 +7,7 @@ pub fn main() {
Styling::run(Settings::default())
}
+#[derive(Default)]
struct Styling {
theme: style::Theme,
input: text_input::State,
@@ -25,12 +26,7 @@ impl Sandbox for Styling {
type Message = Message;
fn new() -> Self {
- Styling {
- theme: style::Theme::Light,
- input: text_input::State::default(),
- input_value: String::new(),
- button: button::State::default(),
- }
+ Styling::default()
}
fn title(&self) -> String {
@@ -106,6 +102,12 @@ mod style {
pub const ALL: [Theme; 2] = [Theme::Light, Theme::Dark];
}
+ impl Default for Theme {
+ fn default() -> Theme {
+ Theme::Light
+ }
+ }
+
impl From<Theme> for Box<dyn container::StyleSheet> {
fn from(theme: Theme) -> Self {
match theme {