servo/rust-mozjs

Property Key Methods

Redfire75369 opened this issue · 2 comments

Currently, there is no way to convert a PropertyKey to a *mut JSString because the methods on PropertyKey are not wrapped.
In the definition of PropertyKey, there are methods such as isString and toString, which would be helpful.

I am currently trying to implement a function which would output all of an object's keys as a Vec<String>, however, this is currently not possible.

jdm commented

As far as I know inline methods like this need to be reimplemented in Rust code. PRs welcome!

I found this a while ago, but forgot to mention it. The functions RUST_JSID_{IS,TO}_{INT,STRING} and RUST_JSID_IS_VOID do exist, just not as a method on the PropertyKey.