Macro tables_to_generic

macro_rules! tables_to_generic {
    ($table:expr, |$generic_name:ident| $e:expr) => { ... };
}
Expand description

Maps a run-time Tables enum value to its corresponding compile-time Table type.

This is a simpler alternative to TableViewer.

§Examples

use reth_db_api::{table::Table, Tables, tables_to_generic};

let table = Tables::Headers;
let result = tables_to_generic!(table, |GenericTable| <GenericTable as Table>::NAME);
assert_eq!(result, table.name());