Before
parent: tbd commit: e432306
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 | // FFIBox::from_box(Box::new(result)).untyped() |
58 | // }; |
59 | |
60 | // let runtime_future = unsafe { FfiFuture::from_raw(poll_local, type_eraser.boxed()) }; |
61 | |
62 | // RuntimeFuture(runtime_future) |
63 | |
64 | todo! |
65 | |
66 | |
67 | |
68 | unsafe extern "C" |
69 | _future: , |
70 | mut future_state: , |
71 | |
72 | let mut future_state: = transmute; |
73 | |
74 | let runtime_future = future_state.as_ref; |
75 | |
76 | let raw_waker = new |
77 | Box into_raw as *const , |
78 | &RUNTIME_FUTURE_WAKER_VTABLE, |
79 | ; |
80 | |
81 | let waker = unsafe ; |
82 | |
83 | // SAFETY: Pretty sure this has to be static lol |
84 | let poll_result = future_state.poll_unpin; |
85 | |
86 | match poll_result |
87 | => Ready, | Ready
88 | => Pending, | Pending
89 | |
90 | |
91 | |
92 | pub static RUNTIME_FUTURE_WAKER_VTABLE: RawWakerVTable = new |
93 | , | waker_clone
94 | , | waker_wake
95 | , | waker_wake_by_ref
96 | , | waker_drop
97 | ; |
98 | |
99 | |
100 | use RawWaker; |
101 | |
102 | pub unsafe |
103 | todo! |
104 | |
105 | |
106 | pub unsafe |
107 | todo! |
108 | |
109 | |
110 | pub unsafe |
111 | todo! |
112 | |
113 | |
114 | pub unsafe |
115 | // no-op |
116 | |
117 | |
118 | |
119 | |
120 | ; |
121 | |
122 | /// Allows for a remote future to be polled on the target. |
123 | /// |
124 | /// The target can be the host or a plugin, but the future should only be polled by one |
125 | /// source. |
126 | |
127 | type Output = Output; |
128 | |
129 | |
130 | mut self: , |
131 | cx: &mut , |
132 | |
133 | let waker_state = WakerState |
134 | waker: cx.waker .clone, |
135 | ; |
136 | |
137 | let waker_state = from; |
138 | |
139 | unsafe ; |
140 | |
141 | match unsafe |
142 | => | Ready
143 | let result: = unsafe ; |
144 | |
145 | Ready |
146 | |
147 | => Pending, | Pending
148 | |
149 | |
150 | |
151 | |
152 | unsafe extern "C" |
153 | todo! |
154 | |
155 |