diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -411,14 +411,14 @@ impl TypeTransform { quote! {#arg.map_err(|x| #err_inner)} } } - TypeTransform::CollectionOneType(type1) => { - let type1 = type1.convert(quote!(v1)); - quote! {#arg.into_iter().map(|v1| #type1).collect()} - } - TypeTransform::CollectionTwoTypes(type1, type2) => { - let type1 = type1.convert(quote!(v1)); - let type2 = type2.convert(quote!(v2)); - quote! {#arg.into_iter().map(|(v1,v2)| (#type1, #type2)).collect()} + TypeTransform::IntoIterMapCollect(types) => { + let idents = (0..types.len()).map(|i| format_ident!("v{}", i)); + // FUTURE: let transforms = std::iter::zip(idents, types).map(|(i, t)| t.convert(quote! {#i})); + let transforms = types.iter().enumerate().map(|(idx, t)| { + let id = format_ident!("v{}", idx); + t.convert(quote! {#id}) + }); + quote! {#arg.into_iter().map(|(#(#idents),*)| (#(#transforms),*)).collect()} } TypeTransform::NoOp => arg, } |