servo / rust-mozjs

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

provide a basic readme with an example on how to eval a result in js #481

Closed r-52 closed 4 years ago

r-52 commented 4 years ago

this PR introduces new blocks in the readme to showcase how to eval a string to a value.

BTW: the minor version is based on the latest published crates.io version. Should this be changed to the latest master? Or is a new release planned?


This change is Reviewable

jdm commented 4 years ago

We are no longer able to publish the mozjs crate (and transitively the rust-mozjs crate) to crates.io because of https://github.com/rust-lang/cargo/issues/6917. The documentation should not recommend using a published version because of this.

r-52 commented 4 years ago

@jdm do you think it makes sense to switch from the version-number-scheme to a Git-url? Or should this be removed?

jhwgh1968 commented 4 years ago

Hi @romankl, I wish I had seen your PR sooner. I created #489 in December, which does something similar in the crate doc string. The main difference is that mine refers to the online User Guide, and specifically translates two example blocks.

Your code helped me when I was tripping over some things in the Rust API. Could we merge our code somehow?

jdm commented 4 years ago

My fear with adding this code to the readme in this form is that it will potentially get out of date when we upgrade spidermonkey, since it's not automatically compiled and validated in CI. I would rather add an examples directory that we can check with cargo build --all-examples.