object_rainbow/
tuple_extra.rs1use crate::{map_extra::MapExtra, *};
2
3#[derive(
4 Debug,
5 ToOutput,
6 InlineOutput,
7 Tagged,
8 ListHashes,
9 Topological,
10 Clone,
11 Copy,
12 Parse,
13 ParseInline,
14 Default,
15 PartialEq,
16 Eq,
17)]
18pub struct Extra0;
19
20impl<A: 'static + Clone, B: 'static + Clone> MapExtra<(A, B)> for Extra0 {
21 type Mapped = A;
22
23 fn map_extra(&self, (extra, _): (A, B)) -> Self::Mapped {
24 extra
25 }
26}
27
28#[derive(
29 Debug,
30 ToOutput,
31 InlineOutput,
32 Tagged,
33 ListHashes,
34 Topological,
35 Clone,
36 Copy,
37 Parse,
38 ParseInline,
39 Default,
40 PartialEq,
41 Eq,
42)]
43pub struct Extra1;
44
45impl<A: 'static + Clone, B: 'static + Clone> MapExtra<(A, B)> for Extra1 {
46 type Mapped = B;
47
48 fn map_extra(&self, (_, extra): (A, B)) -> Self::Mapped {
49 extra
50 }
51}
52
53#[derive(
54 Debug,
55 ToOutput,
56 InlineOutput,
57 Tagged,
58 ListHashes,
59 Topological,
60 Clone,
61 Copy,
62 Parse,
63 ParseInline,
64 Default,
65 PartialEq,
66 Eq,
67)]
68pub struct Swap;
69
70impl<A: 'static + Clone, B: 'static + Clone> MapExtra<(A, B)> for Swap {
71 type Mapped = (B, A);
72
73 fn map_extra(&self, (a, b): (A, B)) -> Self::Mapped {
74 (b, a)
75 }
76}