1#![allow(missing_docs)]
2
3use finchers_core::endpoint::{Context, Endpoint, IntoEndpoint};
4
5pub fn new<E1, E2>(e1: E1, e2: E2) -> Right<E1::Endpoint, E2::Endpoint>
6where
7 E1: IntoEndpoint,
8 E2: IntoEndpoint,
9{
10 Right {
11 e1: e1.into_endpoint(),
12 e2: e2.into_endpoint(),
13 }
14}
15
16#[derive(Debug, Copy, Clone)]
17pub struct Right<E1, E2> {
18 e1: E1,
19 e2: E2,
20}
21
22impl<E1, E2> Endpoint for Right<E1, E2>
23where
24 E1: Endpoint,
25 E2: Endpoint,
26{
27 type Output = E2::Output;
28 type Task = E2::Task;
29
30 fn apply(&self, cx: &mut Context) -> Option<Self::Task> {
31 drop(self.e1.apply(cx)?);
32 let f2 = self.e2.apply(cx)?;
33 Some(f2)
34 }
35}