From 529b6282606d7dc37d6047ec87e6ce85167bd8b5 Mon Sep 17 00:00:00 2001 From: annieversary Date: Thu, 11 Nov 2021 14:16:37 +0000 Subject: [PATCH] m --- src/traversals/each.rs | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/traversals/each.rs b/src/traversals/each.rs index 98689e9..a0d77cb 100644 --- a/src/traversals/each.rs +++ b/src/traversals/each.rs @@ -12,7 +12,6 @@ impl TraversalTraverse> for EachInner { thing } } - impl TraversalOver> for EachInner { fn over(&self, thing: Vec, f: F) -> Vec where @@ -22,6 +21,34 @@ impl TraversalOver> for EachInner { } } +// TODO i'd like to have this so we get it for free on any iterable +// problem is, arrays/tuples don't implement FromIter +// and having both the blanket implementation and the one below complains cause +// other crates could add the trait in the future + +// impl TraversalTraverse for EachInner +// where +// I: IntoIterator, +// { +// type Field = T; + +// fn traverse(&self, thing: I) -> Vec { +// thing.into_iter().collect() +// } +// } + +// impl TraversalOver for EachInner +// where +// I: IntoIterator + FromIterator, +// { +// fn over(&self, thing: I, f: F) -> I +// where +// F: FnMut(Self::Field) -> Self::Field, +// { +// thing.into_iter().map(f).collect() +// } +// } + macro_rules! make_tuples { ($f:ident, ( $( $v:ident ),* ), ( $( $t:ident ),* ) ) => { impl TraversalTraverse<( $($t,)* )> for EachInner {