use rsciter::*; fn main() { if let Err(e) = try_main() { eprintln!("Error: {e}"); } else { println!("Ok!"); } } struct StatefullApi { state: u64, } #[rsciter::xmod] impl StatefullApi { pub fn sum(&self, a: u64, b: u64) -> u64 { a + b + self.state } pub fn update(&mut self, a: u64) { self.state = a; } pub fn state(&self) -> u64 { self.state } } fn try_main() -> Result { let _dbg = rsciter::setup_debug_output(|subsystem, severity, message| { println!("{subsystem:?}, {severity:?}: {message}"); }); app::init()?; let _window = Window::builder() .with_xmodule(StatefullApi { state: 14 }) .with_html(HTML) .build_main()?; let exit_code = app::run()?; app::shutdown()?; Ok(exit_code) } const HTML: &'static [u8] = br#" "#;