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

Write a macro to generate namespaced Ids #26380

Closed
gterzian opened this issue May 1, 2020 · 2 comments
Closed

Write a macro to generate namespaced Ids #26380

gterzian opened this issue May 1, 2020 · 2 comments

Comments

@gterzian
Copy link
Member

@gterzian gterzian commented May 1, 2020

We have a bunch of Indexes and Ids in components/msg/constellation_msg.rs, see for example the BrowsingContextIndex and BrowsingContextId

pub struct BrowsingContextIndex(pub NonZeroU32);

I find myself manually adding new ones regurlarly by hand, perhaps someone wants to write a macro for this? See for example the changes to this file: https://github.com/servo/servo/pull/26317/files#diff-8dc9268416cd4f037d50206e76c73cf9

I'd be great if we could just do something along the lines of namespaced_id!(ServiceWorkerId).

Note that each also require implementing a method on PipelineNamespace, which I guess will have to be done by hand(unless someone has a better idea).

I don't have much, if any, experience writing macros, but I'll venture ahead with a "less easy" label...

@AbhishekSharma102
Copy link
Contributor

@AbhishekSharma102 AbhishekSharma102 commented May 20, 2020

Hey @gterzian, I am new to rust and would like to work on this. Please let me know if no one else is working on this.

@gterzian
Copy link
Member Author

@gterzian gterzian commented May 20, 2020

It's not assigned to anyone, so you can do it if you like!

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.

2 participants
You can’t perform that action at this time.