Open daxpedda opened 4 weeks ago
I'm in favour of the proposal, but yeah, let's wait until after the dust have settled a bit on all the other refactorings
Most likely it would make much more sense to discuss/implement this proposal when we have fully switched to the trait-based system and Event/WindowEvent doesn't exist anymore.
I agree, since the most straightforward and easy to use thing is to pass a e.g. &mut Keymap
along the event, so the user can build what they want with it and change it the way they want.
Currently we deliver all available data in events to the user and our types are accordingly composed:
pub struct Data { pub data_1: ..., ... }
. However sometimes users just don't need all the data and especially when we implement #99 a lot of data (number of things, not size) has to be assembled by the backend.This can sometimes involve multiple callback per field which might be computationally expensive if the user doesn't need all the information. This proposal aims to reduce the impact of this issue by turning delivered events into opaque types where users can query the data they need individually.
The opaque type will most likely have to carry some state with it that will come with a lifetime, so the data can probably not be transferred to a different thread or out of the event loop in a complete package. This will further increase the cost of moving to the trait-based system and the elimination of the
Event
type.Most likely it would make much more sense to discuss/implement this proposal when we have fully switched to the trait-based system and
Event
/WindowEvent
doesn't exist anymore.