-
-
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
Provide a way to guarantee the type is !Unpin #108
Labels
A-unpin
Area: Unpin and UnsafeUnpin
C-enhancement
Category: A new feature or an improvement for an existing one
Comments
taiki-e
added
C-enhancement
Category: A new feature or an improvement for an existing one
A-unpin
Area: Unpin and UnsafeUnpin
labels
Sep 25, 2019
taiki-e
changed the title
Provides a way to guarantee the type is !Unpin
Provide a way to guarantee the type is !Unpin
Sep 25, 2019
We can now support #102 without (It is recommended to always use the default |
FYI: this can be implemented by pub struct Wrapper <'a, T> (PhantomData<&'a ()>, PhantomData<T>);
impl<T> Unpin for Wrapper<'_, T> where T: Unpin {}
impl Unpin for Foo where Wrapper<'_, PhantomPinned>: Unpin {} |
This is equivalent to: #[pin_project]
struct S {
#[pin]
_pin: PhantomPinned,
} And I know that some people are using this: https://github.com/sfackler/rust-postgres/blob/1c843c8b22b37a279172da2ce4ba053506f57802/tokio-postgres/src/copy_out.rs#L46 |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-unpin
Area: Unpin and UnsafeUnpin
C-enhancement
Category: A new feature or an improvement for an existing one
UPDATE: see #108 (comment).
As mentioned in #102, it seems difficult to guarantee this with stable rust at this time.However, I think it would be preferable if an option like
#[pin_project(!Unpin)]
could be provided in the future.Some ways have been mentioned in #102, but it needs to work correctly for generics and conditional implementations in order to use with pin-project.The text was updated successfully, but these errors were encountered: