diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/todos.rs | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/examples/todos.rs b/examples/todos.rs index 6189c8db..9581262a 100644 --- a/examples/todos.rs +++ b/examples/todos.rs @@ -15,26 +15,6 @@ struct Todos { tasks: Vec<Task>, } -#[derive(Debug)] -struct Task { - description: String, - completed: bool, -} - -impl Task { - fn new(description: String) -> Self { - Task { - description, - completed: false, - } - } - - fn view(&mut self) -> Element<bool> { - Checkbox::new(self.completed, &self.description, |checked| checked) - .into() - } -} - #[derive(Debug, Clone)] pub enum Message { InputChanged(String), @@ -107,6 +87,26 @@ impl Application for Todos { } } +#[derive(Debug)] +struct Task { + description: String, + completed: bool, +} + +impl Task { + fn new(description: String) -> Self { + Task { + description, + completed: false, + } + } + + fn view(&mut self) -> Element<bool> { + Checkbox::new(self.completed, &self.description, |checked| checked) + .into() + } +} + // Colors const GRAY: Color = Color { r: 0.5, |