This is a follow-up on #391, which probably should not have been merged as it was. That PR passed checks despite conflating Node vs Widget since every Widget implemented Node (via blanket impl).
Now:
Widget is restored as the "master trait" any widget must implement.
Event-handling methods are moved to a new trait, Events. This is public but with a Sized bound to clarify that it is not intended for use in dyn-safe APIs (Widget implements a dyn-safe API over Events + Layout).
Widget has blanket impls for &mut T and Box<T> where T: Widget + ?Sized. This was not possible with Node due to conflict with the other blanket impl.
This allows user-defined methods to be included in Widget.
This is a follow-up on #391, which probably should not have been merged as it was. That PR passed checks despite conflating
Node
vsWidget
since everyWidget
implementedNode
(via blanket impl).Now:
Widget
is restored as the "master trait" any widget must implement.Events
. This is public but with aSized
bound to clarify that it is not intended for use in dyn-safe APIs (Widget
implements a dyn-safe API overEvents + Layout
).Widget
has blanket impls for&mut T
andBox<T>
whereT: Widget + ?Sized
. This was not possible withNode
due to conflict with the other blanket impl.Widget
.