xilem_web: Factor element state out of the view context via associated type bounds #197
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on this comment and my rather unsatisfying experiments in Philipp-M@039888a
I have removed the need for intermediate state in the view context via a trait
ElementProps
(and in the future likely traits for other DOM interfaces).This requires a new Rust feature
associated_type_bounds
which is not yet in stable Rust, but will be in 1.79 (it unfortunately just missed the window for 1.78).So this will likely stay a draft PR until then as there's no hurry, and the workaround for it is not worth it in the meantime I think, but I wanted to at least make it public (to avoid possibly merge conflicts etc.).
This PR should be seen as a base for future typed features of DOM elements (such as seen in the video example), to avoid putting all the state for all kinds of elements in the context (which will likely blow up WASM blob size).