-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Change the argument type of project method back to self: Pin<&mut Self>
#89
Comments
I thought the effects of doing this.
|
cc @Aaron1011 @Nemo157 @jonhoo @seanmonstar @LucioFranco Any thoughts on this? |
So having just released like 10 of the tower crates that depend on alpha.11, not too excited about this haha. On a real note, would it make sense to wait to see if |
This is certainly what I thought was the most realistic a week ago. However, most of the reason why the current pin-project is unstable is about That being said, this is a fairly breaking change for existing alpha users, so I'd like to help with the update as much as possible (Specifically, I will write a few patches, but is there anything else I can do?). |
In my current usage of I do need the ability to return values bound to the lifetime of the input pin, switching that to be via |
How widely known do you feel it is that people have to call |
Totally makes sense, I'm 👍 on board with this change then. |
I'm not sure about Pin::as_mut, but in the first place, I feel that many of the convenience features related to Pin API are not well known. (Pin::set (tower-rs/tower#323 (comment)), Option::as_pin_mut (tower-rs/tower#316 (comment)), pin_utils::pin_mut (hyperium/hyper#1923), etc...) |
Perhaps it is enough to add a description and an example to the method documentation. There is currently no example and there is no mention of the need to use |
That might be a good start, yes. |
@RalfJung: I've filed rust-lang/rust#64529 |
Add an example to Pin::as_mut taiki-e/pin-project#89 (comment) r? @RalfJung
Add an example to Pin::as_mut taiki-e/pin-project#89 (comment) r? @RalfJung
Add an example to Pin::as_mut taiki-e/pin-project#89 (comment) r? @RalfJung
90: Change the argument type of project method back to `self: Pin<&mut Self>` r=taiki-e a=taiki-e Closes #89 Co-authored-by: Taiki Endo <[email protected]>
I'm going to merge this and some of the existing issues and release beta within a few days. |
The signature of the generated
project
method changes as follows.before:
after:
The advantage of the current approach is that you can call the
project
method multiple times without.as_mut()
.However, there are drawbacks such as requiring a different method to avoid lifetime issues (#65), and not being able to call the method without importing trait (#21 (comment)).
Also, by reverting this, the code generated by the macro will be simpler.
Related: #47 (comment)
PR: #90
The text was updated successfully, but these errors were encountered: