aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-22 09:52:00 +0100
committerMartin Fischer <martin@push-f.com>2021-11-22 09:53:46 +0100
commit3d3e2ac6cdce593ab68c78d583f57905523a1591 (patch)
treec4bac6f7dc9f3313c77239e886f890107b912ded /src/lib.rs
parent4101b0d0f188a7814bdfbf59378b0c528faa7147 (diff)
generalize to collection with one type / two types
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 8fa1294..3b4aeeb 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -411,14 +411,14 @@ impl TypeTransform {
quote! {#arg.map_err(|x| #err_inner)}
}
}
- TypeTransform::Collection(inner) => {
- let inner = inner.convert(quote!(x));
- quote! {#arg.into_iter().map(|x| #inner).collect()}
+ TypeTransform::CollectionOneType(type1) => {
+ let type1 = type1.convert(quote!(v1));
+ quote! {#arg.into_iter().map(|v1| #type1).collect()}
}
- TypeTransform::CollectionMap(key, value) => {
- let key = key.convert(quote!(k));
- let value = value.convert(quote!(v));
- quote! {#arg.into_iter().map(|(k,v)| (#key, #value)).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::NoOp => arg,
}