1#[derive(Debug, Clone, Copy)]
2pub struct NoLoad;
3
4#[derive(Debug, Clone, Copy)]
5pub struct LoadChain<Prev, L> {
6 pub prev: Prev,
7 pub load: L,
8}
9
10pub trait ApplyLoad<Out> {
11 type Out2;
12}
13
14impl<Out> ApplyLoad<Out> for NoLoad {
15 type Out2 = Out;
16}
17
18impl<Out, Prev, L> ApplyLoad<Out> for LoadChain<Prev, L>
19where
20 Prev: ApplyLoad<Out>,
21 L: ApplyLoad<Prev::Out2>,
22{
23 type Out2 = <L as ApplyLoad<Prev::Out2>>::Out2;
24}
25
26#[derive(Debug, Clone, Copy)]
27pub struct SelectIn<R, Nested = NoLoad> {
28 pub rel: R,
29 pub nested: Nested,
30}
31
32impl<R> SelectIn<R, NoLoad> {
33 pub fn new(rel: R) -> Self {
34 Self {
35 rel,
36 nested: NoLoad,
37 }
38 }
39}
40
41impl<R, Nested> SelectIn<R, Nested> {
42 pub fn with<L>(self, load: L) -> SelectIn<R, LoadChain<Nested, L>> {
43 SelectIn {
44 rel: self.rel,
45 nested: LoadChain {
46 prev: self.nested,
47 load,
48 },
49 }
50 }
51}
52
53#[derive(Debug, Clone, Copy)]
54pub struct Joined<R, Nested = NoLoad> {
55 pub rel: R,
56 pub nested: Nested,
57}
58
59impl<R> Joined<R, NoLoad> {
60 pub fn new(rel: R) -> Self {
61 Self {
62 rel,
63 nested: NoLoad,
64 }
65 }
66}
67
68impl<R, Nested> Joined<R, Nested> {
69 pub fn with<L>(self, load: L) -> Joined<R, LoadChain<Nested, L>> {
70 Joined {
71 rel: self.rel,
72 nested: LoadChain {
73 prev: self.nested,
74 load,
75 },
76 }
77 }
78}