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 637a13d
Show file tree
Hide file tree
Showing 50 changed files with 1,310 additions and 331 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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
[docs-url]: https://docs.rs/pin-project
[license-badge]: https://img.shields.io/crates/l/pin-project.svg
[license]: #license
[rustc-badge]: https://img.shields.io/badge/rustc-1.33+-lightgray.svg
[rustc-url]: https://blog.rust-lang.org/2019/02/28/Rust-1.33.0.html
[rustc-badge]: https://img.shields.io/badge/rustc-1.34+-lightgray.svg
[rustc-url]: https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html

A crate for safe and ergonomic pin-projection.

Expand All @@ -29,7 +29,7 @@ Add this to your `Cargo.toml`:
pin-project = "0.4"
```

The current pin-project requires Rust 1.33 or later.
The current pin-project requires Rust 1.34 or later.

## Examples

Expand Down
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 637a13d

Please sign in to comment.