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

Re-export FooMethods and FooCast from DOM module foo #3576

Open
jdm opened this issue Oct 6, 2014 · 7 comments
Open

Re-export FooMethods and FooCast from DOM module foo #3576

jdm opened this issue Oct 6, 2014 · 7 comments
Labels

Comments

@jdm
Copy link
Member

@jdm jdm commented Oct 6, 2014

Instead of making other DOM code import dom::bindings::codegen::Bindings::FooBinding::FooMethods in order to call methods on JSRef<Foo>, we should just re-export (ie. pub use) the FooMethods and FooCast traits for each type in its DOM implementation module. Then users can do use dom::foo::{Foo, FooMethods, FooCast} and it will be much more readable.

@ctlevi
Copy link

@ctlevi ctlevi commented Oct 7, 2014

I'm new to Rust and Servo, but I'm interesting in diving into the language and figured servo was a great place to start. This task seemed simple enough.

After some googling on what exactly pub use is doing, I've got WindowMethods and NodeCast re-exporting and using like use dom::window::{Window, WindowMethods}. I'm not sure what the protocol on grabbing these easy tasks is, but just wanting to let people know I'm taking a look at this one.

@jdm jdm added the C-assigned label Oct 7, 2014
@jdm
Copy link
Member Author

@jdm jdm commented Oct 7, 2014

It's yours!

@gilles-leblanc
Copy link
Contributor

@gilles-leblanc gilles-leblanc commented Feb 10, 2015

@ctlevi Hi, I'm wondering if you're still working on this? Otherwise I would like to take it.

@jdm jdm removed the C-assigned label Feb 10, 2015
@jdm
Copy link
Member Author

@jdm jdm commented Feb 10, 2015

@Manishearth actually has a syntax extension that should be able to accomplish this automatically after the next Rust upgrade, so I don't think it's worth investing the time to do this manually any more.

@Manishearth
Copy link
Member

@Manishearth Manishearth commented Feb 10, 2015

Yeah, I have one. https://github.com/Manishearth/servo/compare/reexport , but it doesn't work yet because rustup (ViewItem is not yet a regular Item)

@jdm jdm removed the E-easy label Feb 20, 2015
@nox
Copy link
Member

@nox nox commented Sep 1, 2015

Not all interfaces have a method trait.

@nox
Copy link
Member

@nox nox commented Sep 1, 2015

We could codegen a module that contains the cast, the constants module and the method trait, and then use * in that from a plugin.

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

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.