Skip to content
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

xilem_web: Factor element state out of the view context via associated type bounds #197

Closed

Conversation

Philipp-M
Copy link
Contributor

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).

@richard-uk1
Copy link
Contributor

Hey this looks cool! Are you planning to take it out of draft at some point?

@Philipp-M
Copy link
Contributor Author

As described, I think it makes sense to wait until Rust 1.79 (where the following feature will be stabilized) since this currently requires unstable Rust:

#![feature(associated_type_bounds)]

Not sure whether it makes sense to make an exception here (as xilem_web is still kinda experimental, and it may otherwise block progress in xilem_web?)

@xStrom
Copy link
Member

xStrom commented Apr 21, 2024

I think we should wait for stable Rust. It's not too far away.

@DJMcNab
Copy link
Member

DJMcNab commented Apr 22, 2024

Yeah - using nightly features makes testing harder, and requires decisions about which nightly to use.

I could maybe see requiring beta, where this would be "stable" in about two weeks. That's what I did for Android Trace, for example.

@Philipp-M
Copy link
Contributor Author

Just that there's no misunderstanding. The required feature won't be in next stable Rust (1.78) but the version after that that is planned for release at 13th June. See here

@Philipp-M
Copy link
Contributor Author

I'm closing this, as I'm currently rewriting xilem_web and found a better/cleaner solution for this.

@Philipp-M Philipp-M closed this Jun 13, 2024
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

Successfully merging this pull request may close these issues.

4 participants