xilem/masonry/src
Olivier FAURE 9ffc650983
Remove `Box<dyn Widget>` from a few places (#837)
Having `Box<dyn Widget>` implement the `Widget` trait is a crutch that
makes a bunch of things more complicated.

It leads to double-boxing in cases when the `dyn Widget` is itself a
`Box<dyn Widget>` (especially since the arena's current implementation
boxes all widgets by default), makes it harder to reason about
downcasting, and ends up producing a lot of code to handle the edge
cases.

On the xilem side, `Box<dyn Widget>` is slightly redundant with
`DynWidget`.

This PR still leaves a lot of boxing. On the long term, we'd like for
the arena to pack arbitrary widgets efficiently using some kind of
archetype scheme, but in the meantime, boxing will have to do.

Changes in this PR:
- New `FromDynWidget` trait that maybe-downcasts widgets to a
maybe-sized `Widget` type.
- Most places that accept `Widget` now accept `Widget + ?Sized`.
- Remove `impl Widget for Box<dyn Widget>`.
- Replace all instances of `WidgetPod<Box<dyn Widget>>` with
`WidgetPod<dyn Widget>`.
- Replace all instances of `xilem::Pod<Box<dyn Widget>>` with
`xilem::Pod<dyn Widget>`.
- Rename WidgetPod to WidgetBox in xilem_core example to avoid
ambiguity.
2025-01-20 12:52:08 +00:00
..
doc Remove `Box<dyn Widget>` from a few places (#837) 2025-01-20 12:52:08 +00:00
passes Remove `Box<dyn Widget>` from a few places (#837) 2025-01-20 12:52:08 +00:00
testing Remove `Box<dyn Widget>` from a few places (#837) 2025-01-20 12:52:08 +00:00
text Emoji picker/selector example (#420) 2025-01-17 17:38:12 +00:00
widget Remove `Box<dyn Widget>` from a few places (#837) 2025-01-20 12:52:08 +00:00
action.rs Document most items in Masonry (#815) 2025-01-13 17:36:31 +00:00
app_driver.rs Make `DriverCtx` publicly constructable again (#821) 2025-01-14 09:39:17 +00:00
box_constraints.rs Document most items in Masonry (#815) 2025-01-13 17:36:31 +00:00
contexts.rs Remove `Box<dyn Widget>` from a few places (#837) 2025-01-20 12:52:08 +00:00
event.rs Apply is/has naming convention for flags and methods (#831) 2025-01-16 15:17:39 +00:00
event_loop_runner.rs Improve handling of window focus (#830) 2025-01-16 14:39:45 +00:00
lib.rs Remove `Box<dyn Widget>` from a few places (#837) 2025-01-20 12:52:08 +00:00
paint_scene_helpers.rs Fix and un-allow `clippy::use_self` lints (#799) 2024-12-19 13:45:57 +00:00
render_root.rs Remove `Box<dyn Widget>` from a few places (#837) 2025-01-20 12:52:08 +00:00
theme.rs Use `palette` and `Color` from top level Xilem and Masonry (#800) 2024-12-20 16:34:11 +00:00
tracing_backend.rs Implement very basic widget inspector (#820) 2025-01-15 17:10:20 +00:00
util.rs Fix and un-allow `clippy::use_self` lints (#799) 2024-12-19 13:45:57 +00:00