use heromodels::db::hero::OurDB; use heromodels::models::calendar::rhai::register_rhai_engine_functions; use rhai::Engine; use std::sync::Arc; use std::{fs, path::Path}; fn main() -> Result<(), Box> { // Initialize Rhai engine let mut engine = Engine::new(); // Initialize database with OurDB let db = Arc::new(OurDB::new("temp_calendar_db", true).expect("Failed to create database")); // Register functions using the new centralized method register_rhai_engine_functions(&mut engine, db.clone()); // Load and evaluate the Rhai script let script_path = Path::new("examples/calendar_rhai/calendar.rhai"); let script = fs::read_to_string(script_path)?; match engine.eval::<()>(&script) { Ok(_) => println!("Script executed successfully!"), Err(e) => eprintln!("Script execution failed: {}", e), } Ok(()) }