-
Notifications
You must be signed in to change notification settings - Fork 655
Rewrite select! as a procedural macro #1363
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
Conversation
This commit removes the old macro_rules tt muncher parser implementation of the select! macro and replaces it with a procedural macro that accomplishes the same task, but which should be dramatically simpler to read and modify.
Haven't read the implementation of the procedural macro yet (will get to it later today) but a quick idea regarding the duplicated documentation -- you could have futures-util provide: #[doc(hidden)]
#[macro_export]
macro_rules! with_documentation_of_select_macro {
($item:item) => {
/// Polls multiple futures and streams simultaneously, ...
$item
};
} which both it and futures use. I forget whether doc comments can be added to an |
proc-macro = true | ||
|
||
[features] | ||
std = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point I figured we could use this to turn off rand
support, though I've left that unimplemented for now. Perhaps we'd require the user to provide a link-time function that could be used to shuffle arrays?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, something like that sounds possible. I was thinking I might take a look at getting it working on no_std
, then realised it wouldn’t work without await!
support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, await!
is the big blocker for getting no-std.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nicely done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me in general.
Just some questions and further ideas.
This commit removes the old macro_rules tt muncher parser
implementation of the select! macro and replaces it with
a procedural macro that accomplishes the same task, but which
should be dramatically simpler to read and modify.