aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 3b4aeeb..caaf774 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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,
}