rhttp/test_rquickjs.rs

17 lines
376 B
Rust

use rquickjs::{AsyncContext, AsyncRuntime, Error};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let rt = AsyncRuntime::new()?;
let ctx = AsyncContext::full(&rt).await?;
ctx.with(|ctx| {
let value: i32 = ctx.eval("1 + 1")?;
println!("1 + 1 = {}", value);
Ok::<(), Error>(())
})
.await?;
Ok(())
}