Introduce Program::run_with to control the initial state

This commit is contained in:
Héctor Ramón Jiménez 2024-03-17 19:15:31 +01:00
parent 92f8dddc2c
commit 943b6c9657
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 60 additions and 37 deletions

View file

@ -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 {