aboutsummaryrefslogtreecommitdiff
path: root/macros/src/util/item_impl.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-08-03 15:09:46 +0200
committerHampusM <hampus@hampusmat.com>2023-08-03 15:15:29 +0200
commita3ccc2713bb5315123814cadd6c50275eee38e1c (patch)
tree22d50e174f3181bbddfd50840408e85e5a4adaac /macros/src/util/item_impl.rs
parent14f1fc1837675e1771e220f848b46213462ae804 (diff)
feat: add constructor name flag to injectable macro
Diffstat (limited to 'macros/src/util/item_impl.rs')
-rw-r--r--macros/src/util/item_impl.rs5
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