Crabzilla

Crabzilla provides a simple interface for running JavaScript modules alongside Rust code.

Example

```rust use crabzilla::*; use std::io::stdin;

[import_fn(name="read", scope="Stdin")]

fn readfromstdin() -> Value { let mut buffer = String::new(); println!("Type your name: "); stdin().read_line(&mut buffer)?; buffer.pop(); Value::String(buffer) }

[import_fn(name="sayHello", scope="Stdout")]

fn say_hello(args: Vec) { if let Some(string) = args.get(0) { if let Value::String(string) = string { println!("Hello, {}", string); } } }

[tokio::main]

async fn main() { let mut runtime = runtime! { readfromstdin, sayhello, }; if let Err(error) = runtime.loadmodule("./module.js").await { eprintln!("{}", error); } } ```

In module.js:

js const user = Stdin.read(); Stdout.sayHello(user);