@@ -7,10 +7,11 @@ use wasm_bindgen_futures::{future_to_promise, JsFuture};
7
7
8
8
use rustpython_vm:: function:: { OptionalArg , PyFuncArgs } ;
9
9
use rustpython_vm:: obj:: {
10
- objdict:: PyDictRef , objfunction:: PyFunctionRef , objint:: PyIntRef , objstr:: PyStringRef ,
11
- objtype:: PyClassRef ,
10
+ objdict:: PyDictRef , objint:: PyIntRef , objstr:: PyStringRef , objtype:: PyClassRef ,
11
+ } ;
12
+ use rustpython_vm:: pyobject:: {
13
+ PyCallable , PyClassImpl , PyObject , PyObjectRef , PyRef , PyResult , PyValue ,
12
14
} ;
13
- use rustpython_vm:: pyobject:: { PyClassImpl , PyObject , PyObjectRef , PyRef , PyResult , PyValue } ;
14
15
use rustpython_vm:: VirtualMachine ;
15
16
16
17
use crate :: { convert, vm_class:: weak_vm, wasm_builtins:: window} ;
@@ -113,7 +114,7 @@ fn browser_fetch(url: PyStringRef, args: FetchArgs, vm: &VirtualMachine) -> PyRe
113
114
Ok ( PyPromise :: from_future ( future) . into_ref ( vm) . into_object ( ) )
114
115
}
115
116
116
- fn browser_request_animation_frame ( func : PyFunctionRef , vm : & VirtualMachine ) -> PyResult {
117
+ fn browser_request_animation_frame ( func : PyCallable , vm : & VirtualMachine ) -> PyResult {
117
118
use std:: { cell:: RefCell , rc:: Rc } ;
118
119
119
120
// this basic setup for request_animation_frame taken from:
@@ -192,8 +193,8 @@ impl PyPromise {
192
193
#[ pymethod]
193
194
fn then (
194
195
& self ,
195
- on_fulfill : PyFunctionRef ,
196
- on_reject : OptionalArg < PyFunctionRef > ,
196
+ on_fulfill : PyCallable ,
197
+ on_reject : OptionalArg < PyCallable > ,
197
198
vm : & VirtualMachine ,
198
199
) -> PyPromiseRef {
199
200
let weak_vm = weak_vm ( vm) ;
@@ -224,7 +225,7 @@ impl PyPromise {
224
225
}
225
226
226
227
#[ pymethod]
227
- fn catch ( & self , on_reject : PyFunctionRef , vm : & VirtualMachine ) -> PyPromiseRef {
228
+ fn catch ( & self , on_reject : PyCallable , vm : & VirtualMachine ) -> PyPromiseRef {
228
229
let weak_vm = weak_vm ( vm) ;
229
230
230
231
let ret_future = JsFuture :: from ( self . value . clone ( ) ) . then ( move |res| {
0 commit comments