use rsciter::*; fn main() { if let Err(e) = try_main() { eprintln!("Error: {e}"); } else { println!("Ok!"); } } #[rsciter::xmod] mod NativeModule { pub fn sum(a: u64, b: u64) -> u64 { a + b } pub fn u64_to_str(a: u64) -> String { format!("{a}") } pub fn i64_to_str(a: i64) -> String { format!("{a}") } } fn try_main() -> Result { app::init()?; let _window = Window::builder() .with_xfunction("printArgs", print_args) .with_xfunction("return13", |_args: &[Value]| Value::int(13).map(Some)) .with_xmodule(NativeModule) .with_html(HTML) .build_main()?; let exit_code = app::run()?; app::shutdown()?; Ok(exit_code) } fn print_args(args: &[Value]) -> Result> { for arg in args { println!("{}", arg.to_string_as(ToStringKind::JsonLiteral).unwrap()); } Ok(None) } const HTML: &'static [u8] = br#" "#;