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
use crate::types::AppId;
#[derive(Copy, Clone)]
pub enum App {
ETH,
ERC20,
}
#[derive(Copy, Clone)]
struct Entry {
pub app: App,
pub id: AppId,
}
static APP_REGISTRY: &[Entry] = &[
Entry {
app: App::ETH,
id: include!(concat!(env!("OUT_DIR"), "/eth_app_id.rs")),
},
Entry {
app: App::ERC20,
id: include!(concat!(env!("OUT_DIR"), "/erc20_app_id.rs")),
}
];
pub fn lookup_app(app_id: AppId) -> Option<App> {
for entry in APP_REGISTRY.iter() {
if app_id == entry.id {
return Some(entry.app)
}
}
None
}