From a3ccc2713bb5315123814cadd6c50275eee38e1c Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 3 Aug 2023 15:09:46 +0200 Subject: feat: add constructor name flag to injectable macro --- macros/src/util/item_impl.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'macros/src/util') diff --git a/macros/src/util/item_impl.rs b/macros/src/util/item_impl.rs index 4bd7492..621f6be 100644 --- a/macros/src/util/item_impl.rs +++ b/macros/src/util/item_impl.rs @@ -1,15 +1,16 @@ +use proc_macro2::Ident; use syn::{ImplItem, ImplItemMethod, ItemImpl}; pub fn find_impl_method_by_name_mut<'item_impl>( item_impl: &'item_impl mut ItemImpl, - method_name: &'static str, + method_name: &Ident, ) -> Option<&'item_impl mut ImplItemMethod> { let impl_items = &mut item_impl.items; impl_items.iter_mut().find_map(|impl_item| match impl_item { ImplItem::Method(method_item) => { - if method_item.sig.ident == method_name { + if &method_item.sig.ident == method_name { Some(method_item) } else { None -- cgit v1.2.3-18-g5258