node-macro: modernize node macro

This commit is contained in:
firestar99
2025-08-26 13:12:27 +02:00
parent aba44eb676
commit 69f9ef30cc
2 changed files with 6 additions and 19 deletions

View File

@@ -13,7 +13,7 @@ mod validation;
#[proc_macro_attribute]
pub fn node(attr: TokenStream, item: TokenStream) -> TokenStream {
// Performs the `node_impl` macro's functionality of attaching an `impl Node for TheGivenStruct` block to the node struct
parsing::new_node_fn(attr.into(), item.into()).into()
parsing::new_node_fn(attr.into(), item.into()).unwrap_or_else(|err| err.to_compile_error()).into()
}
/// Generate meta-information for an enum.
@@ -27,5 +27,5 @@ pub fn node(attr: TokenStream, item: TokenStream) -> TokenStream {
/// Doc comments on a variant become tooltip text.
#[proc_macro_derive(ChoiceType, attributes(widget, menu_separator, label, icon))]
pub fn derive_choice_type(input_item: TokenStream) -> TokenStream {
TokenStream::from(derive_choice_type::derive_choice_type_impl(input_item.into()).unwrap_or_else(|err| err.to_compile_error()))
derive_choice_type::derive_choice_type_impl(input_item.into()).unwrap_or_else(|err| err.to_compile_error()).into()
}