1 use pin_project::pin_project;
2 # [pin (__private (project = EnumProj , project_ref = EnumProjRef))]
3 pub enum Enum<T, U> {
4 Struct {
5 #[pin]
6 pinned: T,
7 unpinned: U,
8 },
9 Tuple(#[pin] T, U),
10 Unit,
11 }
12 #[allow(box_pointers)]
13 #[allow(deprecated)]
14 #[allow(explicit_outlives_requirements)]
15 #[allow(single_use_lifetimes)]
16 #[allow(unreachable_pub)]
17 #[allow(clippy::unknown_clippy_lints)]
18 #[allow(clippy::pattern_type_mismatch)]
19 #[allow(clippy::redundant_pub_crate)]
20 #[allow(dead_code)]
21 #[allow(clippy::mut_mut)]
22 #[allow(clippy::type_repetition_in_bounds)]
23 pub(crate) enum EnumProj<'pin, T, U>
24 where
25 Enum<T, U>: 'pin,
26 {
27 Struct {
28 pinned: ::pin_project::__private::Pin<&'pin mut (T)>,
29 unpinned: &'pin mut (U),
30 },
31 Tuple(::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U)),
32 Unit,
33 }
34 #[allow(box_pointers)]
35 #[allow(deprecated)]
36 #[allow(explicit_outlives_requirements)]
37 #[allow(single_use_lifetimes)]
38 #[allow(unreachable_pub)]
39 #[allow(clippy::unknown_clippy_lints)]
40 #[allow(clippy::pattern_type_mismatch)]
41 #[allow(clippy::redundant_pub_crate)]
42 #[allow(dead_code)]
43 #[allow(clippy::ref_option_ref)]
44 #[allow(clippy::type_repetition_in_bounds)]
45 pub(crate) enum EnumProjRef<'pin, T, U>
46 where
47 Enum<T, U>: 'pin,
48 {
49 Struct {
50 pinned: ::pin_project::__private::Pin<&'pin (T)>,
51 unpinned: &'pin (U),
52 },
53 Tuple(::pin_project::__private::Pin<&'pin (T)>, &'pin (U)),
54 Unit,
55 }
56 #[allow(box_pointers)]
57 #[allow(deprecated)]
58 #[allow(explicit_outlives_requirements)]
59 #[allow(single_use_lifetimes)]
60 #[allow(unreachable_pub)]
61 #[allow(clippy::unknown_clippy_lints)]
62 #[allow(clippy::pattern_type_mismatch)]
63 #[allow(clippy::redundant_pub_crate)]
64 #[allow(clippy::semicolon_if_nothing_returned)]
65 #[allow(clippy::used_underscore_binding)]
66 const _: () = {
67 impl<T, U> Enum<T, U> {
project<'pin>( self: ::pin_project::__private::Pin<&'pin mut Self>, ) -> EnumProj<'pin, T, U>68 pub(crate) fn project<'pin>(
69 self: ::pin_project::__private::Pin<&'pin mut Self>,
70 ) -> EnumProj<'pin, T, U> {
71 unsafe {
72 match self.get_unchecked_mut() {
73 Self::Struct { pinned, unpinned } => EnumProj::Struct {
74 pinned: ::pin_project::__private::Pin::new_unchecked(pinned),
75 unpinned,
76 },
77 Self::Tuple(_0, _1) => {
78 EnumProj::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1)
79 }
80 Self::Unit => EnumProj::Unit,
81 }
82 }
83 }
84 #[allow(clippy::missing_const_for_fn)]
project_ref<'pin>( self: ::pin_project::__private::Pin<&'pin Self>, ) -> EnumProjRef<'pin, T, U>85 pub(crate) fn project_ref<'pin>(
86 self: ::pin_project::__private::Pin<&'pin Self>,
87 ) -> EnumProjRef<'pin, T, U> {
88 unsafe {
89 match self.get_ref() {
90 Self::Struct { pinned, unpinned } => EnumProjRef::Struct {
91 pinned: ::pin_project::__private::Pin::new_unchecked(pinned),
92 unpinned,
93 },
94 Self::Tuple(_0, _1) => {
95 EnumProjRef::Tuple(::pin_project::__private::Pin::new_unchecked(_0), _1)
96 }
97 Self::Unit => EnumProjRef::Unit,
98 }
99 }
100 }
101 }
102 #[allow(missing_debug_implementations)]
103 pub struct __Enum<'pin, T, U> {
104 __pin_project_use_generics: ::pin_project::__private::AlwaysUnpin<
105 'pin,
106 (
107 ::pin_project::__private::PhantomData<T>,
108 ::pin_project::__private::PhantomData<U>,
109 ),
110 >,
111 __field0: T,
112 __field1: T,
113 }
114 impl<'pin, T, U> ::pin_project::__private::Unpin for Enum<T, U> where
115 __Enum<'pin, T, U>: ::pin_project::__private::Unpin
116 {
117 }
118 #[doc(hidden)]
119 unsafe impl<'pin, T, U> ::pin_project::UnsafeUnpin for Enum<T, U> where
120 __Enum<'pin, T, U>: ::pin_project::__private::Unpin
121 {
122 }
123 trait EnumMustNotImplDrop {}
124 #[allow(clippy::drop_bounds, drop_bounds)]
125 impl<T: ::pin_project::__private::Drop> EnumMustNotImplDrop for T {}
126 impl<T, U> EnumMustNotImplDrop for Enum<T, U> {}
127 #[doc(hidden)]
128 impl<T, U> ::pin_project::__private::PinnedDrop for Enum<T, U> {
drop(self: ::pin_project::__private::Pin<&mut Self>)129 unsafe fn drop(self: ::pin_project::__private::Pin<&mut Self>) {}
130 }
131 };
main()132 fn main() {}
133