reth_db

Macro tables_to_generic

Source
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::{Tables, tables_to_generic};
use reth_db_api::table::Table;

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