Debian Codegraph @

third_party/rust/pin-project/examples/README.md

raw
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/1/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/1/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/1/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/1/pin_project/attr.pin_project.html#unpin)
36
37 Note: These generated code examples are the little simplified version of the
38 actual generated code. See [expansion tests](../tests#expansion-tests-expand-expandtestrs) if you
39 want to see the exact version of the actual generated code.