Crabzilla provides a simple interface for running JavaScript modules alongside Rust code.
```rust use crabzilla::*; use std::io::stdin;
fn readfromstdin() -> Value { let mut buffer = String::new(); println!("Type your name: "); stdin().read_line(&mut buffer)?; buffer.pop(); Value::String(buffer) }
fn say_hello(args: Vec
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);