From 943b6c965773748f8cacaa4fe385ac4a3bfb1e69 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 17 Mar 2024 19:15:31 +0100 Subject: Introduce `Program::run_with` to control the initial state --- examples/tour/src/main.rs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'examples/tour/src/main.rs') diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs index be6e24d5..a88c0dba 100644 --- a/examples/tour/src/main.rs +++ b/examples/tour/src/main.rs @@ -21,19 +21,13 @@ pub fn main() -> iced::Result { .run() } +#[derive(Default)] pub struct Tour { steps: Steps, debug: bool, } impl Tour { - fn new() -> Self { - Self { - steps: Steps::new(), - debug: false, - } - } - fn title(&self) -> String { format!("{} - Iced", self.steps.title()) } @@ -90,12 +84,6 @@ impl Tour { } } -impl Default for Tour { - fn default() -> Self { - Self::new() - } -} - #[derive(Debug, Clone)] pub enum Message { BackPressed, @@ -177,6 +165,12 @@ impl Steps { } } +impl Default for Steps { + fn default() -> Self { + Steps::new() + } +} + enum Step { Welcome, Slider { -- cgit