basically fully restored

This commit is contained in:
Sebastian Moser
2026-10-23 12:11:32 +02:00
parent 9078b108a6
commit 2b2d40148b
25 changed files with 879 additions and 37 deletions

View File

@@ -2,7 +2,7 @@ use std::any::Any;
use crate::MizeResult;
use crate::c_api::get_global_mize;
use crate::get_global_mize;
use crate::id::MizeId;
use crate::item::{IntoItemData, ItemData};
use crate::Mize;
@@ -86,14 +86,14 @@ pub mod c_api {
unsafe {
let c_str = CStr::from_ptr(name);
let string = c_str.to_string_lossy();
super::opt(string.as_str())
super::opt(&string)
}
}
pub extern "C" fn method(name: *const c_char, c_fun: CFun) {
unsafe {
let c_str = CStr::from_ptr(name);
let string = c_str.to_string_lossy();
super::method(string.as_str(), move |args| {
super::method(&string, move |args| {
let raw_ptr = Box::into_raw(Box::new(args));
let ret_ptr = c_fun(raw_ptr);
let data = *Box::from_raw(ret_ptr);
@@ -105,7 +105,7 @@ pub mod c_api {
unsafe {
let c_str = CStr::from_ptr(name);
let string = c_str.to_string_lossy();
super::effect(string.as_str(), move |args| {
super::effect(&string, move |args| {
let raw_ptr = Box::into_raw(Box::new(args));
let ret_ptr = c_fun(raw_ptr);
let data = *Box::from_raw(ret_ptr);
@@ -117,7 +117,7 @@ pub mod c_api {
unsafe {
let c_str = CStr::from_ptr(name);
let string = c_str.to_string_lossy();
super::thread(string.as_str(), move |args| {
super::thread(&string, move |args| {
let raw_ptr = Box::into_raw(Box::new(args));
let ret_ptr = c_fun(raw_ptr);
let data = *Box::from_raw(ret_ptr);