MCPcopy Create free account
hub / github.com/HFQR/xitca-web / find_async_method

Function find_async_method

codegen/src/lib.rs:55–72  ·  view source on GitHub ↗
(items: &'a [ImplItem], ident_str: &str)

Source from the content-addressed store, hash-verified

53}
54
55fn 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}

Callers 2

try_from_itemMethod · 0.85
errorFunction · 0.85

Calls 2

iterMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected