Releases: taiki-e/pin-project
0.4.22
0.4.21
-
Consider naming the projected type by passing an argument with the same name as the method to the #[pin_project] attribute instead.
use pin_project::pin_project; use std::pin::Pin; #[pin_project(project = EnumProj)] enum Enum<T> { Variant(#[pin] T), } fn func<T>(x: Pin<&mut Enum<T>>) { match x.project() { EnumProj::Variant(y) => { let _: Pin<&mut T> = y; } } }
See #225 for more details.
-
Diagnostic improvements.
0.4.20
-
You can now use project_replace argument without Replace argument.
This used to require you to specify both.- #[pin_project(Replace, project_replace = EnumProjOwn)] + #[pin_project(project_replace = EnumProjOwn)] enum Enum<T> { Variant(#[pin] T) }
-
Makes
project_replace
argument an alias forReplace
argument so that it can be used without a value.#[pin_project(project_replace)] enum Enum<T> { Variant(#[pin] T) }
The
Replace
argument will be deprecated in the future. -
Suppress
unreachable_pub
lint in generated code.
0.4.19
0.4.18
-
Support
Self
in more syntax positions inside#[pinned_drop]
impl. -
Documentation improvements.
-
Diagnostic improvements.
0.4.17
-
Support naming the projection types.
By passing an argument with the same name as the method to the attribute, you can name the projection type returned from the method:
use pin_project::pin_project; use std::pin::Pin; #[pin_project(project = EnumProj)] enum Enum<T> { Variant(#[pin] T), } fn func<T>(x: Pin<&mut Enum<T>>) { match x.project() { EnumProj::Variant(y) => { let _: Pin<&mut T> = y; } } }
0.4.16
0.4.15
0.4.14
-
Added
!Unpin
option to#[pin_project]
attribute for guarantee the type is!Unpin
.use pin_project::pin_project; #[pin_project(!Unpin)] struct Struct<T, U> { field: T, }
This is equivalent to use
#[pin]
attribute forPhantomPinned
field.use pin_project::pin_project; use std::marker::PhantomPinned; #[pin_project] struct Struct<T, U> { field: T, #[pin] // Note that using `PhantomPinned` without `#[pin]` attribute has no effect. _pin: PhantomPinned, }
Note: This raises the minimum supported Rust version of this crate from rustc 1.33 to rustc 1.34.
-
Fixed an issue where duplicate
#[project]
attributes were ignored. -
Hide generated items from --document-private-items. See #211 for more details.
-
Improve documentation