diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/isolate.rs | 8 | ||||
-rw-r--r-- | src/libdeno.rs | 12 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/isolate.rs b/src/isolate.rs index 5daa98675..3379eb80d 100644 --- a/src/isolate.rs +++ b/src/isolate.rs @@ -141,9 +141,11 @@ impl Isolate { DENO_INIT.call_once(|| { unsafe { libdeno::deno_init() }; }); - let shared = libdeno::deno_buf::empty(); // TODO Use shared for message passing. - let libdeno_isolate = - unsafe { libdeno::deno_new(snapshot, shared, pre_dispatch) }; + let config = libdeno::deno_config { + shared: libdeno::deno_buf::empty(), // TODO Use for message passing. + recv_cb: pre_dispatch, + }; + let libdeno_isolate = unsafe { libdeno::deno_new(snapshot, config) }; // This channel handles sending async messages back to the runtime. let (tx, rx) = mpsc::channel::<(i32, Buf)>(); diff --git a/src/libdeno.rs b/src/libdeno.rs index e293f2461..3e41c7d60 100644 --- a/src/libdeno.rs +++ b/src/libdeno.rs @@ -96,15 +96,17 @@ type DenoRecvCb = unsafe extern "C" fn( data_buf: deno_buf, ); +#[repr(C)] +pub struct deno_config { + pub shared: deno_buf, + pub recv_cb: DenoRecvCb, +} + extern "C" { pub fn deno_init(); pub fn deno_v8_version() -> *const c_char; pub fn deno_set_v8_flags(argc: *mut c_int, argv: *mut *mut c_char); - pub fn deno_new( - snapshot: deno_buf, - shared: deno_buf, - cb: DenoRecvCb, - ) -> *const isolate; + pub fn deno_new(snapshot: deno_buf, config: deno_config) -> *const isolate; pub fn deno_delete(i: *const isolate); pub fn deno_last_exception(i: *const isolate) -> *const c_char; pub fn deno_check_promise_errors(i: *const isolate); |