servo / rust-mozjs

DEPRECATED - moved to servo/mozjs instead.
Mozilla Public License 2.0
293 stars 117 forks source link

Exports of mozjs_sys::jsgc::* #546

Open Redfire75369 opened 3 years ago

Redfire75369 commented 3 years ago

RootedGuard<'_, T> requires that T implement mozjs_sys::jsgc::RootKind.

This issues involves exporting mozjs_sys::jsgc::* in mozjs.

Reason

Currently, I am unable to create a generic function that does this as this struct is not exported by mozjs. This will be useful for creating utility functions to set a value without requiring you to manually convert it using ToJSValConvertible.

Implementation Code

// src/lib.rs

pub use mozjs_sys::jsgc;
jdm commented 3 years ago

mozjs_sys is a separate crate at https://github.com/servo/mozjs/blob/ef986b1a2c23081fe4d37aeaab5323d3dec033f3/src/jsgc.rs#L20, so you can depend on that without changing this crate.

Redfire75369 commented 3 years ago

It is possible to depend on both simultaneously, but due to mozjs depending mozjs_sys as well, you have to specify the exact commit of mozjs_sys that your current version of mozjs uses. This means it is more difficult and inconvenient to update mozjs.