|
1 |
| -use alloy_primitives::{U256, U512}; |
2 |
| - |
3 |
| -use crate::{ |
4 |
| - mock_db::MockDb, |
5 |
| - table::types::TableId, |
6 |
| - types::{Data, Index}, |
7 |
| - utils::string_to_fixed_bytes_be_vec, |
8 |
| -}; |
9 |
| - |
10 |
| -use super::AfsInterface; |
11 |
| - |
12 |
| -pub enum AfsInterfaceEnum<'a> { |
13 |
| - Index2Data2(AfsInterface<'a, u16, u16>), |
14 |
| - Index4Data4(AfsInterface<'a, u32, u32>), |
15 |
| - Index32Data32(AfsInterface<'a, U256, U256>), |
16 |
| - // Add more variants as needed |
17 |
| -} |
18 |
| - |
19 |
| -pub fn create_interface<'a>( |
20 |
| - index_bytes: usize, |
21 |
| - data_bytes: usize, |
22 |
| - db_ref: &'a mut MockDb, |
23 |
| -) -> AfsInterfaceEnum<'a> { |
24 |
| - match (index_bytes, data_bytes) { |
25 |
| - (2, 2) => AfsInterfaceEnum::Index2Data2(AfsInterface::<'a, u16, u16>::new(db_ref)), |
26 |
| - (4, 4) => AfsInterfaceEnum::Index4Data4(AfsInterface::<'a, u32, u32>::new(db_ref)), |
27 |
| - _ => panic!("Unknown variant"), |
28 |
| - } |
29 |
| -} |
| 1 | +use crate::{table::types::TableId, utils::string_to_fixed_bytes_be_vec}; |
30 | 2 |
|
31 | 3 | pub fn string_to_table_id(s: String) -> TableId {
|
32 | 4 | let bytes = string_to_fixed_bytes_be_vec(s, 32);
|
|
0 commit comments