Skip to content

Commit

Permalink
Implement !Unpin option
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed May 9, 2020
1 parent bd78d55 commit 2706e39
Show file tree
Hide file tree
Showing 50 changed files with 1,452 additions and 303 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
# This is the minimum supported Rust version of this crate.
# When updating this, the reminder to update the minimum supported
# Rust version in README.md.
- build: 1.33.0
rust: 1.33.0
- build: 1.34.0
rust: 1.34.0
- build: 1.36.0
rust: 1.36.0
- build: 1.37.0
Expand Down
34 changes: 34 additions & 0 deletions pin-project-internal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,40 @@ use crate::utils::{Immutable, Mutable, Owned};
///
/// See also [`project`] and [`project_ref`] attributes.
///
/// ## `!Unpin`
///
/// If you want to ensure that [`Unpin`] is not implemented, use the `!Unpin`
/// argument to `#[pin_project]`.
///
/// ```rust
/// use pin_project::pin_project;
///
/// #[pin_project(!Unpin)]
/// struct Struct<T, U> {
/// #[pin]
/// pinned: T,
/// unpinned: U,
/// }
/// ```
///
/// You can also ensure `!Unpin` by using `#[pin]` attribute for [`PhantomPinned`] field.
///
/// ```rust
/// use pin_project::pin_project;
/// use std::marker::PhantomPinned;
///
/// #[pin_project]
/// struct Struct<T, U> {
/// #[pin]
/// pinned: T,
/// unpinned: U,
/// #[pin]
/// _pin: PhantomPinned,
/// }
/// ```
///
/// Note that using [`PhantomPinned`] without `#[pin]` attribute has no effect.
///
/// ## `UnsafeUnpin`
///
/// If you want to implement [`Unpin`] manually, you must use the `UnsafeUnpin`
Expand Down
Loading

0 comments on commit 2706e39

Please sign in to comment.