PkmnLib_rs/src/ffi/dynamic_data/mod.rs

18 lines
604 B
Rust

use std::ffi::{c_char, CString};
/// The foreign function interfaces for the turn choices
mod choices;
/// The foreign function interfaces for the dynamic data libraries
mod libraries;
/// The foreign function interfaces for the dynamic data models
mod models;
/// The library the battle uses for handling.
#[no_mangle]
#[allow(clippy::unwrap_used)]
extern "C" fn set_script_error_handler(func: unsafe extern "C" fn(*mut c_char)) {
crate::dynamic_data::set_script_error_handler(Box::new(move |e: &anyhow_ext::Error| unsafe {
func(CString::new(e.to_string()).unwrap().into_raw())
}));
}