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

web-sys types should probably impl Deref to types they're inheriting #842

Closed
upsuper opened this issue Sep 16, 2018 · 4 comments
Closed

Comments

@upsuper
Copy link

upsuper commented Sep 16, 2018

Currently, for example if you have an Element, but you want to use first_child from Node, you have to either e.into::<Node>().first_child() or (e.as_ref() as &Node).first_child(). If would be great if one can just use e.first_child() without explicit type conversion.

Types defined in WebIDL can only have single inheritance, so I think this is doable via Deref chain.

@afdw
Copy link
Contributor

afdw commented Sep 16, 2018

Check rustwasm/rfcs#3.

@upsuper
Copy link
Author

upsuper commented Sep 16, 2018

Thanks for the pointer. It seems that the conversion there leans towards having Deref as well. Closing this issue for now.

@upsuper upsuper closed this as completed Sep 16, 2018
@upsuper
Copy link
Author

upsuper commented Sep 18, 2018

Maybe we can keep this open until the proposed change in rustwasm/rfcs#3 is actually implemented?

@upsuper upsuper reopened this Sep 18, 2018
@alexcrichton
Copy link
Contributor

Ah I'm gonna close this in favor of the RFC. If we decide to merge that then we can have a tracking issue here to implement that, but until that happens all discussion should be on the RFC!

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

3 participants