[−][src]Crate pin_project
A crate for safe and ergonomic pin-projection.
Examples
pin_project
attribute creates a projection struct covering all the fields.
use pin_project::pin_project; use std::pin::Pin; #[pin_project] struct Struct<T, U> { #[pin] pinned: T, unpinned: U, } impl<T, U> Struct<T, U> { fn foo(self: Pin<&mut Self>) { let this = self.project(); let _: Pin<&mut T> = this.pinned; // Pinned reference to the field let _: &mut U = this.unpinned; // Normal reference to the field } }
Code like this will be generated
See pin_project
attribute for more details.
Also, there are examples and generated code of each feature in examples directory.
Traits
UnsafeUnpin | A trait used for custom implementations of [ |
Attribute Macros
pin_project | An attribute that creates a projection struct covering all the fields. |
pinned_drop | An attribute for annotating an impl block that implements [ |
project | An attribute to provide way to refer to the projected type returned by
|
project_ref | An attribute to provide way to refer to the projected type returned by
|