summaryrefslogtreecommitdiffstats
path: root/pure/src/widget/tree.rs
diff options
context:
space:
mode:
Diffstat (limited to 'pure/src/widget/tree.rs')
-rw-r--r--pure/src/widget/tree.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/pure/src/widget/tree.rs b/pure/src/widget/tree.rs
index 2353edc5..1ab6d80b 100644
--- a/pure/src/widget/tree.rs
+++ b/pure/src/widget/tree.rs
@@ -58,4 +58,18 @@ impl Tree {
*self = Self::new(new);
}
}
+
+ pub fn state<T>(&self) -> &T
+ where
+ T: 'static,
+ {
+ self.state.downcast_ref().expect("Downcast widget state")
+ }
+
+ pub fn state_mut<T>(&mut self) -> &mut T
+ where
+ T: 'static,
+ {
+ self.state.downcast_mut().expect("Downcast widget state")
+ }
}