(info: &FieldInfo)
| 209 | } |
| 210 | |
| 211 | fn map_from_fields(info: &FieldInfo) -> proc_macro2::TokenStream { |
| 212 | let ident = info.field.ident.as_ref().unwrap(); |
| 213 | |
| 214 | if info.is_option() { |
| 215 | if info.is_nested_validify() && info.is_list() { |
| 216 | return quote!( |
| 217 | #ident: payload.#ident.map(|v|v.into_iter().map(|el|el.into()).collect()), |
| 218 | ); |
| 219 | } |
| 220 | |
| 221 | if info.is_nested_validify() { |
| 222 | return quote!( |
| 223 | #ident: payload.#ident.map(|o|o.into()), |
| 224 | ); |
| 225 | } |
| 226 | |
| 227 | quote!( |
| 228 | #ident: payload.#ident, |
| 229 | ) |
| 230 | } else { |
| 231 | if info.is_nested_validify() && info.is_list() { |
| 232 | return quote!(#ident: payload.#ident.unwrap().into_iter().map(|el|el.into()).collect(),); |
| 233 | } |
| 234 | |
| 235 | if info.is_nested_validify() { |
| 236 | return quote!(#ident: payload.#ident.unwrap().into(),); |
| 237 | } |
| 238 | |
| 239 | quote!(#ident: payload.#ident.unwrap(),) |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | fn map_into_fields(info: &FieldInfo) -> proc_macro2::TokenStream { |
| 244 | let ident = info.field.ident.as_ref().unwrap(); |
nothing calls this directly
no test coverage detected