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
use super::TableName;
#[derive(Debug, PartialEq, Eq, Clone, Copy, Default, Hash, PartialOrd, Ord)]
pub struct SecondaryTableName(TableName, usize);
impl SecondaryTableName {
#[inline]
#[must_use]
pub const fn new(primary: TableName, index: usize) -> Self {
Self(primary, index)
}
#[inline]
#[must_use]
pub const fn primary(&self) -> TableName {
self.0
}
#[inline]
#[must_use]
pub const fn index(&self) -> usize {
self.1
}
#[must_use]
pub const fn as_u64(&self) -> u64 {
let index = self.1 as u64;
let table = self.0.as_u64();
(table & 0xFFFF_FFFF_FFFF_FFF0_u64)
| (index & 0x0000_0000_0000_000F_u64)
}
}
impl From<SecondaryTableName> for u64 {
#[inline]
#[must_use]
fn from(t: SecondaryTableName) -> Self {
t.as_u64()
}
}