forked from hydro-project/hydroflow
/
push_pivot.rs
42 lines (36 loc) · 829 Bytes
/
push_pivot.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use super::{BaseSurface, PullSurface, PushSurface, PushSurfaceReversed};
use super::pivot::PivotSurface;
pub struct PivotPushSurface<Pull>
where
Pull: PullSurface,
{
pull: Pull,
}
impl<Pull> PivotPushSurface<Pull>
where
Pull: PullSurface,
{
pub fn new(pull: Pull) -> Self {
Self { pull }
}
}
impl<Pull> BaseSurface for PivotPushSurface<Pull>
where
Pull: PullSurface,
{
type ItemOut = Pull::ItemOut;
}
impl<Pull> PushSurface for PivotPushSurface<Pull>
where
Pull: PullSurface,
{
type Output<Next> = PivotSurface<Pull, Next>
where
Next: PushSurfaceReversed<ItemIn = Self::ItemOut>;
fn push_to<Next>(self, next: Next) -> Self::Output<Next>
where
Next: PushSurfaceReversed<ItemIn = Self::ItemOut>,
{
PivotSurface::new(self.pull, next)
}
}