Skip to content

Support passing multiple input data references / lifetime GATs #488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dhardy opened this issue Apr 5, 2025 · 0 comments
Open

Support passing multiple input data references / lifetime GATs #488

dhardy opened this issue Apr 5, 2025 · 0 comments

Comments

@dhardy
Copy link
Collaborator

dhardy commented Apr 5, 2025

Type Widget::Data is passed by reference and must have lifetime exceeding the widget (i.e. usually 'static). Implications:

  • We cannot generate input data on-the-fly; it must be stored in the widget tree somewhere (e.g. it may be generated and cached by fn Events::update).
  • We cannot pass multiple references as input data.

The generic solution to this would be to make type Widget::Data a GAT over a lifetime parameter, but Rust does not currently support usage of GATs in dyn-safe traits (see also #25) and we require that Widget be dyn-safe.

There may be other (partial) solutions, but any evaluated solutions are worse than forcing widgets to work around this limitation. (This might continue to be the case even if Rust does support dyn-safe lifetime GATs, but should be re-evaluated.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant