yagen/compose.rs
1// use super::*;
2
3pub struct Compose<F0, F1>(F0, F1);
4
5/*
6impl<F0: FlatScan, F1: FlatScan<Input = <F0::OutputGenerator as Generator>::Yield> + Copy> FlatScan for Compose<F0, F1> {
7 type Input = F0::Input;
8 type OutputGenerator = FlatScanGenerator<F0::OutputGenerator, F1>;
9 fn map_input(
10 self,
11 ret: Option<<Self::OutputGenerator as Generator>::Return>,
12 input: Self::Input,
13 ) -> Self::OutputGenerator {
14 let r = self.0.map_input(ret.map(|v| v.1), input);
15 r
16 }
17}
18
19pub trait ComposeSugar: FlatScan + Sized {
20 fn compose<F: FlatScan>(self, f: F) -> Compose<Self, F>;
21}
22
23impl<S: FlatScan> ComposeSugar for S {
24 fn compose<F: FlatScan>(self, f: F) -> Compose<Self, F> {
25 Compose(self, f)
26 }
27}
28*/