DioxusLabs / dioxus

Fullstack GUI library for web, desktop, mobile, and more.
https://dioxuslabs.com
Apache License 2.0
19.45k stars 748 forks source link

Collapse events to `Event<dyn Data>` #2041

Open jkelleyrtp opened 4 months ago

jkelleyrtp commented 4 months ago

Feature Request

We go through many layers of indirection to support concrete methods on events, but I'm starting to think that the overhead and maintenance burden is not worth it, and that we can mostly solve the discoverability problem either through docs or clever foreign impls.

For example, we stuff dyn HasMouseData inside a MouseData inside an event via Rc which is quite a lot of cruft to wade through.

In reality, I'd like to be able to simply jump to the trait and get its methods rather than dig through 3-4 levels of indirection.

pub struct MouseData {
    inner: Box<dyn HasMouseData>,
}