Parse assignment expression like n1=v1, n2=v2, etc.
(attr_str: &str)
| 150 | |
| 151 | /// Parse assignment expression like n1=v1, n2=v2, etc. |
| 152 | pub fn parse_exprs(attr_str: &str) -> HashMap<String, String> { |
| 153 | let mut expr_map = HashMap::new(); |
| 154 | if attr_str == "" { |
| 155 | return expr_map; |
| 156 | } |
| 157 | |
| 158 | let attrs = attr_str.split(","); |
| 159 | let exprs: Vec<&str> = attrs.into_iter().map(|u| u).collect(); |
| 160 | for exp_str in exprs.into_iter() { |
| 161 | let expr = match syn::parse_str::<Meta>(exp_str) { |
| 162 | Ok(x) => x, |
| 163 | Err(_) => return HashMap::new(), |
| 164 | }; |
| 165 | expr_map.insert(expr.0, expr.1); |
| 166 | } |
| 167 | |
| 168 | expr_map |
| 169 | } |
| 170 | |
| 171 | pub fn parse_args_from_sig(sig: &mut syn::Signature) -> syn::Result<Vec<FnArg>> { |
| 172 | let iter = sig |
no outgoing calls
no test coverage detected