Debian Codegraph @

debian/missing-sources/pin-project-lite/tests/include/basic.rs

raw
1 // SPDX-License-Identifier: Apache-2.0 OR MIT
2
3 // default pin_project! is completely safe.
4
5 ::pin_project_lite::pin_project! {
6 /// Testing default struct.
7 #[derive(Debug)]
8 #[allow(clippy::exhaustive_structs)] // for the type itself
9 pub struct DefaultStruct<T, U> {
10 #[pin]
11 pub pinned: T,
12 pub unpinned: U,
13 }
14 }
15
16 ::pin_project_lite::pin_project! {
17 /// Testing named struct.
18 #[allow(clippy::exhaustive_structs)] // for the type itself
19 #[project = DefaultStructProj]
20 #[project_ref = DefaultStructProjRef]
21 #[derive(Debug)]
22 pub struct DefaultStructNamed<T, U> {
23 #[pin]
24 pub pinned: T,
25 pub unpinned: U,
26 }
27 }
28
29 ::pin_project_lite::pin_project! {
30 /// Testing enum.
31 #[allow(clippy::exhaustive_enums)] // for the type itself
32 #[project = DefaultEnumProj]
33 #[project_ref = DefaultEnumProjRef]
34 #[derive(Debug)]
35 pub enum DefaultEnum<T, U> {
36 /// Struct variant.
37 Struct {
38 #[pin]
39 pinned: T,
40 unpinned: U,
41 },
42 /// Unit variant.
43 Unit,
44 }
45 }
46
47 ::pin_project_lite::pin_project! {
48 /// Testing pinned drop struct.
49 #[allow(clippy::exhaustive_structs)] // for the type itself
50 #[derive(Debug)]
51 pub struct PinnedDropStruct<T, U> {
52 #[pin]
53 pub pinned: T,
54 pub unpinned: U,
55 }
56 impl<T, U> PinnedDrop for PinnedDropStruct<T, U> {
57 fn drop(_this: Pin<&mut Self>) {}
58 }
59 }
60
61 ::pin_project_lite::pin_project! {
62 /// Testing pinned drop enum.
63 #[allow(clippy::absolute_paths, clippy::exhaustive_enums)] // for the type itself
64 #[project = PinnedDropEnumProj]
65 #[project_ref = PinnedDropEnumProjRef]
66 #[derive(Debug)]
67 pub enum PinnedDropEnum<T: ::pin_project_lite::__private::Unpin, U> {
68 /// Struct variant.
69 Struct {
70 #[pin]
71 pinned: T,
72 unpinned: U,
73 },
74 /// Unit variant.
75 Unit,
76 }
77 #[allow(clippy::absolute_paths)]
78 impl<T: ::pin_project_lite::__private::Unpin, U> PinnedDrop for PinnedDropEnum<T, U> {
79 fn drop(_this: Pin<&mut Self>) {}
80 }
81 }