1use std::ops::{Deref, DerefMut};
2use field_collex::{Collexetable};
3use crate::Id;
4
5#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)]
6#[derive(serde::Serialize, serde::Deserialize)]
7pub struct Pair<K,O>(pub K, pub O)
8where
9 K: Id,
10;
11
12impl<K: Id,E> Deref for Pair<K,E>{
13 type Target = E;
14 fn deref(&self) -> &Self::Target {
15 &self.1
16 }
17}
18
19impl<K: Id,E> DerefMut for Pair<K,E>{
20 fn deref_mut(&mut self) -> &mut Self::Target {
21 &mut self.1
22 }
23}
24
25impl<K,E,V> Collexetable<V> for Pair<K,E>
26where
27 K: Id,
28 E: Collexetable<V>,
29{
30 fn collexate(&self) -> V {
31 self.1.collexate()
32 }
33
34 fn collexate_ref(&self) -> &V {
35 self.1.collexate_ref()
36 }
37
38 fn collexate_mut(&mut self) -> &mut V {
39 self.1.collexate_mut()
40 }
41}