Add ctype new support

This commit is contained in:
2025-06-22 18:41:19 +10:00
parent 0fd59f6874
commit 40478fb7de
7 changed files with 118 additions and 81 deletions

View File

@@ -39,7 +39,7 @@ unsafe impl<T: FromFfi> FromFfi for Option<T> {
fn prelude(arg: &str) -> impl Display {
let ct = Self::From::name();
display!(
"if {arg} == nil then {arg} = __cnew(__ctypes.{ct}); else {}{arg} = __cnew(__ctypes.{ct}, 1, {arg}); end; ",
"if {arg} == nil then {arg} = __new(__ct.{ct}); else {}{arg} = __new(__ct.{ct}, 1, {arg}); end; ",
T::prelude(arg)
)
}