(items: &'a [ImplItem], ident_str: &str)
| 53 | } |
| 54 | |
| 55 | fn find_async_method<'a>(items: &'a [ImplItem], ident_str: &str) -> Option<Result<&'a ImplItemFn, Error>> { |
| 56 | for item in items.iter() { |
| 57 | if let ImplItem::Fn(func) = item { |
| 58 | if func.sig.ident.to_string().as_str() == ident_str { |
| 59 | if func.sig.asyncness.is_none() { |
| 60 | return Some(Err(Error::new( |
| 61 | func.span(), |
| 62 | format!("{ident_str} method must be async fn"), |
| 63 | ))); |
| 64 | } |
| 65 | |
| 66 | return Some(Ok(func)); |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | None |
| 72 | } |
no test coverage detected