File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,8 @@ pub struct Future {
163163impl Future {
164164 /// Registers a callback to be called upon completion of this future. If the future has already
165165 /// completed, the callback will be called immediately.
166+ ///
167+ /// (C-not exported) use the bindings-only `register_callback_fn` instead
166168 pub fn register_callback ( & self , callback : Box < dyn FutureCallback > ) {
167169 let mut state = self . state . lock ( ) . unwrap ( ) ;
168170 if state. complete {
@@ -172,6 +174,16 @@ impl Future {
172174 state. callbacks . push ( callback) ;
173175 }
174176 }
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+ }
175187}
176188
177189mod std_future {
You can’t perform that action at this time.
0 commit comments