diff options
Diffstat (limited to 'engine-macros/src/reflection/field.rs')
| -rw-r--r-- | engine-macros/src/reflection/field.rs | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/engine-macros/src/reflection/field.rs b/engine-macros/src/reflection/field.rs index 95671c3..7c50f47 100644 --- a/engine-macros/src/reflection/field.rs +++ b/engine-macros/src/reflection/field.rs @@ -6,7 +6,6 @@ pub struct ReflectionFieldGenOptions<'a> { pub field_vis_override: Option<syn::Visibility>, pub gen_get_byte_offset: &'a dyn Fn(&syn::Field) -> proc_macro2::TokenStream, - pub type_reflection_optional: bool, } pub fn generate( @@ -34,11 +33,8 @@ pub fn generate( let field_reflection_vis = generate_visibility(field_vis, &engine_crate_path); - let get_type_fn_body = if options.type_reflection_optional { - gen_get_optional_type_reflection(field_type, engine_crate_path) - } else { - gen_get_mandatory_type_reflection(field_type, engine_crate_path) - }; + let get_type_fn_body = + { gen_get_optional_type_reflection(field_type, engine_crate_path) }; quote! { #engine_crate_path::reflection::Field { @@ -102,19 +98,3 @@ fn gen_get_optional_type_reflection( .field_type_reflection() } } - -fn gen_get_mandatory_type_reflection( - field_type: &syn::Type, - engine_crate_path: &syn::Path, -) -> proc_macro2::TokenStream -{ - quote! { - fn field_type_reflection<T: #engine_crate_path::reflection::Reflection>() - -> &'static #engine_crate_path::reflection::Type - { - T::type_reflection() - } - - Some(field_type_reflection::<#field_type>()) - } -} |
