MOre pre vtable changes
parent: tbd commit: 9cfa135
1 | use BoxFuture; |
2 | use FutureExt; |
3 | use ; |
4 | use |
5 | , | UnsafeCell
6 | , | Future
7 | , | PhantomData
8 | , | transmute
9 | , |
10 | ; |
11 | |
12 | use crate::; |
13 | |
14 | |
15 | |
16 | callback: PluginState, |
17 | waker_func: unsafe extern "C" fn , |
18 | |
19 | |
20 | |
21 | waker: Waker, |
22 | |
23 | |
24 | unsafe extern "C" |
25 | |
26 | |
27 | inner: , |
28 | runtime_future: , |
29 | |
30 | |
31 | unsafe |
32 | unsafe |
33 | |
34 | |
35 | |
36 | |
37 | |
38 | todo! |
39 | |
40 | |
41 | |
42 | |
43 | |
44 | &self, |
45 | future: F, |
46 | ; |
47 | |
48 | |
49 | |
50 | |
51 | &self, |
52 | future: F, |
53 | |
54 | let type_eraser = async move |
55 | let result = future.await; |
56 | |
57 | untyped | from_box .
58 | ; |
59 | |
60 | let runtime_future = unsafe ; |
61 | |
62 | RuntimeFuture |
63 | |
64 | |
65 | |
66 | unsafe extern "C" |
67 | _future: , |
68 | mut future_state: , |
69 | |
70 | let mut future_state: = transmute; |
71 | |
72 | let runtime_future = future_state.as_ref; |
73 | |
74 | let raw_waker = new |
75 | Box into_raw as *const , |
76 | &RUNTIME_FUTURE_WAKER_VTABLE, |
77 | ; |
78 | |
79 | let waker = unsafe ; |
80 | |
81 | // SAFETY: Pretty sure this has to be static lol |
82 | let poll_result = future_state.poll_unpin; |
83 | |
84 | match poll_result |
85 | => Ready, | Ready
86 | => Pending, | Pending
87 | |
88 | |
89 | |
90 | pub static RUNTIME_FUTURE_WAKER_VTABLE: RawWakerVTable = new |
91 | , | waker_clone
92 | , | waker_wake
93 | , | waker_wake_by_ref
94 | , | waker_drop
95 | ; |
96 | |
97 | |
98 | use RawWaker; |
99 | |
100 | pub unsafe |
101 | todo! |
102 | |
103 | |
104 | pub unsafe |
105 | todo! |
106 | |
107 | |
108 | pub unsafe |
109 | todo! |
110 | |
111 | |
112 | pub unsafe |
113 | // no-op |
114 | |
115 | |
116 | |
117 | |
118 | ; |
119 | |
120 | /// Allows for a remote future to be polled on the target. |
121 | /// |
122 | /// The target can be the host or a plugin, but the future should only be polled by one |
123 | /// source. |
124 | |
125 | type Output = Output; |
126 | |
127 | |
128 | mut self: , |
129 | cx: &mut , |
130 | |
131 | let waker_state = WakerState |
132 | waker: cx.waker .clone, |
133 | ; |
134 | |
135 | let waker_state = from; |
136 | |
137 | unsafe ; |
138 | |
139 | match unsafe |
140 | => | Ready
141 | let result: = unsafe ; |
142 | |
143 | Ready |
144 | |
145 | => Pending, | Pending
146 | |
147 | |
148 | |
149 | |
150 | unsafe extern "C" |
151 | todo! |
152 | |
153 |