Factor helper code out of generated code
Nobody likes coding inside a string literal!
diff --git a/src/gen/fold.rs b/src/gen/fold.rs
index d8fbd91..2d6a92d 100644
--- a/src/gen/fold.rs
+++ b/src/gen/fold.rs
@@ -10,30 +10,8 @@
#![cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))]
use *;
-use delimited::Delimited;
use proc_macro2::Span;
-
-trait FoldHelper {
- type Item;
- fn lift<F>(self, f: F) -> Self where F: FnMut(Self::Item) -> Self::Item;
-}
-
-impl<T> FoldHelper for Vec<T> {
- type Item = T;
- fn lift<F>(self, f: F) -> Self where F: FnMut(Self::Item) -> Self::Item {
- self.into_iter().map(f).collect()
- }
-}
-
-impl<T, U> FoldHelper for Delimited<T, U> {
- type Item = T;
- fn lift<F>(self, mut f: F) -> Self where F: FnMut(Self::Item) -> Self::Item {
- self.into_iter().map(|elem| {
- let (t, u) = elem.into_tuple();
- (f(t), u)
- }).collect::<Vec<(T, Option<U>)>>().into()
- }
-}
+use gen::helper::fold::*;
#[cfg(feature = "full")]