• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Examples and generated code of each feature of pin-project
2
3## Basic usage of `#[pin_project]` on structs
4
5- [example](struct-default.rs)
6- [generated code](struct-default-expanded.rs)
7
8## Basic usage of `#[pin_project]` on enums
9
10- [example](enum-default.rs)
11- [generated code](enum-default-expanded.rs)
12
13## Manual implementation of `Unpin` by `UnsafeUnpin`
14
15- [example](unsafe_unpin.rs)
16- [generated code](unsafe_unpin-expanded.rs)
17- [`UnsafeUnpin` documentation](https://docs.rs/pin-project/latest/pin_project/trait.UnsafeUnpin.html)
18
19## Manual implementation of `Drop` by `#[pinned_drop]`
20
21- [example](pinned_drop.rs)
22- [generated code](pinned_drop-expanded.rs)
23- [`#[pinned_drop]` documentation](https://docs.rs/pin-project/latest/pin_project/attr.pinned_drop.html)
24
25## `project_replace()` method
26
27- [example](project_replace.rs)
28- [generated code](project_replace-expanded.rs)
29- [`project_replace()` documentation](https://docs.rs/pin-project/latest/pin_project/attr.pin_project.html#project_replace-method)
30
31## Ensure `!Unpin` by `#[pin_project(!Unpin)]`
32
33- [example](not_unpin.rs)
34- [generated code](not_unpin-expanded.rs)
35- [`!Unpin` documentation](https://docs.rs/pin-project/latest/pin_project/attr.pin_project.html#unpin)
36
37---
38
39Note: These generated code examples are the little simplified version of the
40actual generated code. See [expansion tests](../tests#expansion-tests-expand-expandtestrs) if you
41want to see the exact version of the actual generated code.
42