-
Notifications
You must be signed in to change notification settings - Fork 341
expose task::ready!
#133
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
expose task::ready!
#133
Conversation
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.
I believe you forgot to push the changes.
Instead of re-exporting the macro from #[macro_export]
macro_rules! ready {
($e:expr $(,)?) => {
match $e {
::std::task::Poll::Ready(t) => t,
::std::task::Poll::Pending => return ::std::task::Poll::Pending,
}
};
} As for the placement of the macro, I wonder if we should just put it in the root module? That's what the standard library does with its macros - they're all in the root module and re-exported from the prelude. I believe that's for historical reasons because at Rust 1.0 it was not possible to place macros in arbitrary modules and they had to be in the crate root (they weren't even importable!), but this convention has kind of stuck and now all new macros still get added there. We already have one such macro placed into root, |
@stjepang that's exactly what I did in the first pass at this, and the only way I got it to work was by re-exporting it from an external module. I mean: we should probably create async-macros anyway, but I figured for now I'd just go with the easiest path which is to re-export the futures macro. |
If we're going to add the By the way, another benefit of not re-exporting stuff from the |
@stjepang we probably shouldn't name it There's recent precedent for exposing submodule macros in std now too I believe; Alex recently had something on this. I'll ping him about it. |
@stjepang another thought: what are we going to do about The other option for them is to change their naming to be |
57111d0
to
b66509e
Compare
Signed-off-by: Yoshua Wuyts <[email protected]>
Signed-off-by: Yoshua Wuyts <[email protected]>
b66509e
to
d5725e7
Compare
Signed-off-by: Yoshua Wuyts <[email protected]>
Signed-off-by: Yoshua Wuyts <[email protected]>
We now have |
Export
async_std::task::ready!
. Thanks!