Expose reusable Button logic

... and reuse it in `iced_pure`!
This commit is contained in:
Héctor Ramón Jiménez 2022-02-11 23:17:07 +07:00
parent 01c5004959
commit ecb3df8e01
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
5 changed files with 228 additions and 247 deletions

View file

@ -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")
}
}