rust-windowing / rust-windowing/winit
Opaque/On-Demand Data
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 6.2k
- Forks
- 1.3k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 9
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the current Event and WindowEvent types and the proposed trait-based system, including the dependency on issue #99. Compare how event data is currently assembled with the proposed opaque, on-demand access model. Done would require an agreed design for the API, state and lifetime handling, and thread-transfer behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100