diff options
author | 2024-03-17 19:15:31 +0100 | |
---|---|---|
committer | 2024-03-17 19:15:31 +0100 | |
commit | 943b6c965773748f8cacaa4fe385ac4a3bfb1e69 (patch) | |
tree | c4382d4e3a5fe1af312c307c05d2e4fc227c8795 /examples/tour/src/main.rs | |
parent | 92f8dddc2c9fd5f625292a9a83288d9695e41bc2 (diff) | |
download | iced-943b6c965773748f8cacaa4fe385ac4a3bfb1e69.tar.gz iced-943b6c965773748f8cacaa4fe385ac4a3bfb1e69.tar.bz2 iced-943b6c965773748f8cacaa4fe385ac4a3bfb1e69.zip |
Introduce `Program::run_with` to control the initial state
Diffstat (limited to '')
-rw-r--r-- | examples/tour/src/main.rs | 20 |
1 files changed, 7 insertions, 13 deletions
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 { |