diff options
author | HampusM <hampus@hampusmat.com> | 2023-08-03 15:09:46 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-08-03 15:15:29 +0200 |
commit | a3ccc2713bb5315123814cadd6c50275eee38e1c (patch) | |
tree | 22d50e174f3181bbddfd50840408e85e5a4adaac /macros/src/util | |
parent | 14f1fc1837675e1771e220f848b46213462ae804 (diff) |
feat: add constructor name flag to injectable macro
Diffstat (limited to 'macros/src/util')
-rw-r--r-- | macros/src/util/item_impl.rs | 5 |
1 files changed, 3 insertions, 2 deletions
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 |