diff options
author | HampusM <hampus@hampusmat.com> | 2022-08-27 23:41:41 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-08-27 23:41:41 +0200 |
commit | e0f90a8e384615c79d7d51c66d19294d75e79391 (patch) | |
tree | f3df3d1cd92f7d4a978feaa5a9a5f773dd0901ee /macros/src/util/item_impl.rs | |
parent | d4078c84a83d121a4e3492955359cedb3b404476 (diff) |
feat: implement named bindings
Diffstat (limited to 'macros/src/util/item_impl.rs')
-rw-r--r-- | macros/src/util/item_impl.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/macros/src/util/item_impl.rs b/macros/src/util/item_impl.rs index 271ae2f..4bd7492 100644 --- a/macros/src/util/item_impl.rs +++ b/macros/src/util/item_impl.rs @@ -1,13 +1,13 @@ use syn::{ImplItem, ImplItemMethod, ItemImpl}; -pub fn find_impl_method_by_name<'item_impl>( - item_impl: &'item_impl ItemImpl, +pub fn find_impl_method_by_name_mut<'item_impl>( + item_impl: &'item_impl mut ItemImpl, method_name: &'static str, -) -> Option<&'item_impl ImplItemMethod> +) -> Option<&'item_impl mut ImplItemMethod> { - let impl_items = &item_impl.items; + let impl_items = &mut item_impl.items; - impl_items.iter().find_map(|impl_item| match impl_item { + impl_items.iter_mut().find_map(|impl_item| match impl_item { ImplItem::Method(method_item) => { if method_item.sig.ident == method_name { Some(method_item) @@ -15,6 +15,6 @@ pub fn find_impl_method_by_name<'item_impl>( None } } - &_ => None, + &mut _ => None, }) } |