standing_relations/convenience/
pair.rs

1pub trait Pair {
2    type Fst;
3    type Snd;
4
5    fn swap(self) -> (Self::Snd, Self::Fst);
6    fn fst(self) -> Self::Fst;
7    fn snd(self) -> Self::Snd;
8}
9
10impl<A, B> Pair for (A, B) {
11    type Fst = A;
12    type Snd = B;
13
14    fn swap(self) -> (B, A) {
15        (self.1, self.0)
16    }
17
18    fn fst(self) -> Self::Fst {
19        self.0
20    }
21
22    fn snd(self) -> Self::Snd {
23        self.1
24    }
25}