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
43
44
45
46
47
use std::any::Any;
use super::sealed::IsSession;
use super::*;
#[repr(transparent)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct Continue<N: Unary = Z>(pub N);
impl<N: Unary + Any> IsSession for Continue<N> {}
impl<N: Unary + Any> Session for Continue<N> {
type Dual = Continue<N>;
}
impl<N: Unary + Any, M: Unary + Any> Scoped<M> for Continue<N> where N: LessThan<M> {}
impl<E, P, Rest, N: Unary> Actionable<E> for Continue<N>
where
E: Select<N, Selected = P, Remainder = Rest> + Environment,
Continue<N>: Scoped<E::Depth>,
P: Actionable<(P, Rest)>,
P: Scoped<S<<Rest as Environment>::Depth>>,
P::Dual: Scoped<S<Rest::Depth>>,
(P, Rest): Environment,
Rest: Environment,
{
type Action = <P as Actionable<(P, Rest)>>::Action;
type Env = <P as Actionable<(P, Rest)>>::Env;
}
#[cfg(test)]
mod tests {
use super::*;
use crate::assert_all_closed_sessions;
#[test]
fn break_good() {
assert_all_closed_sessions!(
Loop<Send<i64, Continue>>,
Loop<Send<i64, Loop<Continue<_1>>>>,
Loop<Send<String, Continue>>,
);
}
}