feat: add __lang/rusty_jsc/, build_readme.rs

This commit is contained in:
2022-08-28 11:40:00 +08:00
parent 5d1372905f
commit 0b0d4f2f9c
8 changed files with 325 additions and 2 deletions

34
__lang/rusty_jsc/Cargo.lock generated Normal file
View File

@@ -0,0 +1,34 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "pkg-config"
version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
[[package]]
name = "rusty_jsc"
version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97f314ea60a5ccbadc997f67a5bca81dc48e7058850e44f05911ce7f22c307de"
dependencies = [
"rusty_jsc_sys",
]
[[package]]
name = "rusty_jsc"
version = "0.1.0"
dependencies = [
"rusty_jsc 0.0.1",
]
[[package]]
name = "rusty_jsc_sys"
version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e139e91ef225f39929b7e8228584500dafd1fa407f2aedd45faa30398f0568c2"
dependencies = [
"pkg-config",
]

View File

@@ -0,0 +1,10 @@
[package]
name = "rusty_jsc"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rusty_jsc = "0.0.1"

View File

@@ -0,0 +1,17 @@
use rusty_jsc::JSContext;
fn main() {
let mut context = JSContext::default();
match context.evaluate_script("'hello, world'", 1) {
Some(value) => {
println!("{}", value.to_string(&context));
}
None => {
println!(
"Uncaught: {}",
context.get_exception().unwrap().to_string(&context)
)
}
}
}