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 8285f7e commit d3c2100
Show file tree
Hide file tree
Showing 50 changed files with 1,315 additions and 326 deletions.
2 changes: 1 addition & 1 deletion ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ echo "Running 'cargo fmt -- --check'"
cargo +nightly fmt --all -- --check

echo "Running 'cargo clippy'"
cargo +nightly clippy --all --all-features
cargo +nightly clippy --all --all-features --all-targets

echo "Running 'cargo test'"
cargo +nightly test --all --all-features
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 d3c2100

Please sign in to comment.