From cfc164d83deceb6ed02684722667fccadffe26c0 Mon Sep 17 00:00:00 2001 From: 0x192 Date: Tue, 29 Mar 2022 22:55:06 +0200 Subject: Implement `Default` for `pure::State` Impure Applications using pure widgets can now use a struct implementing `Default` --- pure/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'pure') diff --git a/pure/src/lib.rs b/pure/src/lib.rs index 71d20a4d..c16b12b0 100644 --- a/pure/src/lib.rs +++ b/pure/src/lib.rs @@ -41,6 +41,14 @@ pub struct State { state_tree: widget::Tree, } +impl Default for State { + fn default() -> Self { + Self { + state_tree: widget::Tree::empty(), + } + } +} + impl State { pub fn new() -> Self { Self { -- cgit