-
Notifications
You must be signed in to change notification settings - Fork 649
Update async_block* macros to support Stable & Unpin #936
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
Perhaps the naming here should be inverted to |
|
@awestlake87 unfortunately the async/await RFC has reserved that syntax for async closures (which I'm slightly tempted to try implementing for I think changing |
@Nemo157 I see, I forgot it needed to be called in order to act as a future. The macro does look cleaner, although I'd definitely prefer the first class syntax in that RFC in the longterm. I'm glad there's talk about adding futures to core and stabilizing async/await separately from proc_macro2 and generators. As for the naming, I agree with @Nemo157 when it comes to changing async_block! to immovable by default because that's how closures act in rust. I think I'm leaning more towards |
Changes `async_block` and `async_stream_block` to return `StableFuture` and `StableStream` respectively. Adds new `async_block_unpin` and `async_stream_block_unpin` to create `Future`s and `Stream`s from blocks instead.
I'm inclined to do just remove the current |
Subsumed by #964 |
I'm not sold on the name, especially since it uses a completely different meaning to the
pinned
argument to#[async]
. I could do the same as has happened to#[async]
and changeasync_block
to return aStableFuture
along with a newasync_block_move
macro forFuture
.My preferred way to do this would be to keep a single
async_block
macro and pass an argument to it as posited in #918 for#[async(move)]
(along with the change toStableFuture
by default); I've been trying to come up with a way to nicely pass attributes to theasync_block
macro, but I can't think of anything I'm really attached to. The best I came up with was something like:which I believe is unambiguous because
$($ident,)+ { $($tt)+ }
cannot be parsed as anexpr
.