Added support for generic structs in LuaDeviceConfig

This commit is contained in:
Dreaded_X 2024-12-08 01:53:04 +01:00
parent 14aabe202d
commit eefb476d7f
Signed by: Dreaded_X
GPG Key ID: FA5F485356B0D2D4

View File

@ -260,8 +260,9 @@ pub fn impl_lua_device_config_macro(ast: &DeriveInput) -> TokenStream {
})
.collect();
let (impl_generics, type_generics, where_clause) = ast.generics.split_for_impl();
let impl_from_lua = quote! {
impl mlua::FromLua for #name {
impl #impl_generics mlua::FromLua for #name #type_generics #where_clause {
fn from_lua(value: mlua::Value, lua: &mlua::Lua) -> mlua::Result<Self> {
if !value.is_table() {
panic!("Expected table");