Skip to content
This repository was archived by the owner on Nov 12, 2022. It is now read-only.

Commit c4bfaaa

Browse files
committed
Added Rust Bindings for JSExternalStringCallbacks
1 parent 6893940 commit c4bfaaa

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/glue.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,17 @@ pub struct ReadableStreamUnderlyingSourceTraps {
7575
>,
7676
}
7777

78+
#[repr(C)]
79+
#[derive(Copy, Clone, Default)]
80+
pub struct JSExternalStringCallbacksTraps {
81+
pub finalize: ::std::option::Option<
82+
unsafe extern "C" fn(*const c_void, *mut ::libc::wchar_t)
83+
>,
84+
pub sizeOfBuffer: ::std::option::Option<
85+
unsafe extern "C" fn(*const c_void, *const ::libc::wchar_t, MallocSizeOf) -> ::libc::size_t
86+
>,
87+
}
88+
7889
#[repr(C)]
7990
#[derive(Copy, Clone)]
8091
pub struct ProxyTraps {
@@ -578,6 +589,11 @@ extern "C" {
578589
source: *const c_void,
579590
) -> *mut JS::ReadableStreamUnderlyingSource;
580591
pub fn DeleteReadableStreamUnderlyingSource(source: *mut JS::ReadableStreamUnderlyingSource);
592+
pub fn CreateJSExternalStringCallbacks(
593+
traps: *const JSExternalStringCallbacksTraps,
594+
privateData: *const c_void,
595+
) -> *mut JSExternalStringCallbacks;
596+
pub fn DeleteJSExternalStringCallbacks(callbacks: *mut JSExternalStringCallbacks);
581597
pub fn DispatchableRun(
582598
cx: *mut JSContext,
583599
ptr: *mut JS::Dispatchable,

src/jsglue.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,9 +1244,9 @@ DeleteReadableStreamUnderlyingSource(JS::ReadableStreamUnderlyingSource* source)
12441244
}
12451245

12461246
JSExternalStringCallbacks*
1247-
CreateRustJSExternalStringCallbacks(const JSExternalStringCallbacksTraps* aTraps, void* aCallbacks)
1247+
CreateRustJSExternalStringCallbacks(const JSExternalStringCallbacksTraps* aTraps, void* privateData)
12481248
{
1249-
return new RustJSExternalStringCallbacks(*aTraps, aCallbacks);
1249+
return new RustJSExternalStringCallbacks(*aTraps, privateData);
12501250
}
12511251

12521252
void DeleteRustJSExternalStringCallbacks(JSExternalStringCallbacks* callbacks)

0 commit comments

Comments
 (0)