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