Skip to main content

with_adapter

Macro with_adapter 

Source
macro_rules! with_adapter {
    ($settings_provider:expr, |$A:ident| $body:expr) => { ... };
}
Available on crate features trie and trie-db only.
Expand description

Dispatches a trie operation using the correct TrieKeyAdapter based on storage settings.

The first argument must implement StorageSettingsCache. Inside the closure body, $A is a type alias for either PackedKeyAdapter or LegacyKeyAdapter.

§Example

reth_trie_db::with_adapter!(provider, |A| {
    let factory = DatabaseTrieCursorFactory::<_, A>::new(tx);
    // ...
})