File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,8 @@ pub struct Future {
163
163
impl Future {
164
164
/// Registers a callback to be called upon completion of this future. If the future has already
165
165
/// completed, the callback will be called immediately.
166
+ ///
167
+ /// (C-not exported) use the bindings-only `register_callback_fn` instead
166
168
pub fn register_callback ( & self , callback : Box < dyn FutureCallback > ) {
167
169
let mut state = self . state . lock ( ) . unwrap ( ) ;
168
170
if state. complete {
@@ -172,6 +174,16 @@ impl Future {
172
174
state. callbacks . push ( callback) ;
173
175
}
174
176
}
177
+
178
+ // C bindings don't (currently) know how to map `Box<dyn Trait>`, and while it could add the
179
+ // following wrapper, doing it in the bindings is currently much more work than simply doing it
180
+ // here.
181
+ /// Registers a callback to be called upon completion of this future. If the future has already
182
+ /// completed, the callback will be called immediately.
183
+ #[ cfg( c_bindings) ]
184
+ pub fn register_callback_fn < F : ' static + FutureCallback > ( & self , callback : F ) {
185
+ self . register_callback ( Box :: new ( callback) ) ;
186
+ }
175
187
}
176
188
177
189
mod std_future {
You can’t perform that action at this time.
0 commit comments