annieversary 2021-11-11 14:16:37 +00:00
parent 6b339ddde1
commit 529b628260
1 changed files with 28 additions and 1 deletions

View File

@ -12,7 +12,6 @@ impl<T> TraversalTraverse<Vec<T>> for EachInner {
thing
}
}
impl<T> TraversalOver<Vec<T>> for EachInner {
fn over<F>(&self, thing: Vec<T>, f: F) -> Vec<T>
where
@ -22,6 +21,34 @@ impl<T> TraversalOver<Vec<T>> 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<I, T> TraversalTraverse<I> for EachInner
// where
// I: IntoIterator<Item = T>,
// {
// type Field = T;
// fn traverse(&self, thing: I) -> Vec<Self::Field> {
// thing.into_iter().collect()
// }
// }
// impl<I, T> TraversalOver<I> for EachInner
// where
// I: IntoIterator<Item = T> + FromIterator<T>,
// {
// fn over<F>(&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<T> TraversalTraverse<( $($t,)* )> for EachInner {