commit 9642b9243db949e1241651ed89c8c3866daa03bd parent 22e4b727290c7b881707f1d33e0f8bea1051f013 Author: William Casarin <jb55@jb55.com> Date: Fri, 19 Apr 2024 17:38:47 -0700 a quick note about the View trait Signed-off-by: William Casarin <jb55@jb55.com> Diffstat:
M | src/ui/mod.rs | | | 7 | +++++++ |
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/ui/mod.rs b/src/ui/mod.rs @@ -8,6 +8,13 @@ pub use username::Username; use egui::Margin; +/// This is kind of like the Widget trait but is meant for larger top-level +/// views that are typically stateful. The Widget trait forces us to add mutable +/// implementations at the type level, which screws us when generating Previews +/// for a Widget. I would have just Widget instead of making this Trait otherwise. +/// +/// There is some precendent for this, it looks like there's a similar trait +/// in the egui demo library. pub trait View { fn ui(&mut self, ui: &mut egui::Ui); }