reth_db/static_file/
mask.rs
1use reth_db_api::table::Decompress;
2
3pub trait ColumnSelectorOne {
5 type FIRST: Decompress;
7 const MASK: usize;
9}
10
11pub trait ColumnSelectorTwo {
13 type FIRST: Decompress;
15 type SECOND: Decompress;
17 const MASK: usize;
19}
20
21pub trait ColumnSelectorThree {
23 type FIRST: Decompress;
25 type SECOND: Decompress;
27 type THIRD: Decompress;
29 const MASK: usize;
31}
32
33#[macro_export]
34macro_rules! add_static_file_mask {
36 ($(#[$attr:meta])* $mask_struct:ident $(<$generic:ident>)?, $type1:ty, $mask:expr) => {
37 $(#[$attr])*
38 #[derive(Debug)]
39 pub struct $mask_struct$(<$generic>)?$((std::marker::PhantomData<$generic>))?;
40
41 impl$(<$generic>)? ColumnSelectorOne for $mask_struct$(<$generic>)?
42 where
43 $type1: Send + Sync + std::fmt::Debug + reth_db_api::table::Decompress,
44 {
45 type FIRST = $type1;
46 const MASK: usize = $mask;
47 }
48 };
49 ($(#[$attr:meta])* $mask_struct:ident $(<$generic:ident>)?, $type1:ty, $type2:ty, $mask:expr) => {
50 $(#[$attr])*
51 #[derive(Debug)]
52 pub struct $mask_struct$(<$generic>)?$((std::marker::PhantomData<$generic>))?;
53
54 impl$(<$generic>)? ColumnSelectorTwo for $mask_struct$(<$generic>)?
55 where
56 $type1: Send + Sync + std::fmt::Debug + reth_db_api::table::Decompress,
57 $type2: Send + Sync + std::fmt::Debug + reth_db_api::table::Decompress,
58 {
59 type FIRST = $type1;
60 type SECOND = $type2;
61 const MASK: usize = $mask;
62 }
63 };
64 ($(#[$attr:meta])* $mask_struct:ident $(<$generic:ident>)?, $type1:ty, $type2:ty, $type3:ty, $mask:expr) => {
65 $(#[$attr])*
66 #[derive(Debug)]
67 pub struct $mask_struct$(<$generic>)?$((std::marker::PhantomData<$generic>))?;
68
69 impl$(<$generic>)? ColumnSelectorThree for $mask_struct$(<$generic>)?
70 where
71 $type1: Send + Sync + std::fmt::Debug + reth_db_api::table::Decompress,
72 $type2: Send + Sync + std::fmt::Debug + reth_db_api::table::Decompress,
73 $type3: Send + Sync + std::fmt::Debug + reth_db_api::table::Decompress,
74 {
75 type FIRST = $type1;
76 type SECOND = $type2;
77 type THIRD = $type3;
78 const MASK: usize = $mask;
79 }
80 };
81}