reth_trie_parallel/
storage_root_targets.rsuse alloy_primitives::{map::B256HashMap, B256};
use derive_more::{Deref, DerefMut};
use reth_trie::prefix_set::PrefixSet;
#[derive(Deref, DerefMut, Debug)]
pub struct StorageRootTargets(B256HashMap<PrefixSet>);
impl StorageRootTargets {
pub fn new(
changed_accounts: impl IntoIterator<Item = B256>,
storage_prefix_sets: impl IntoIterator<Item = (B256, PrefixSet)>,
) -> Self {
Self(
changed_accounts
.into_iter()
.map(|address| (address, PrefixSet::default()))
.chain(storage_prefix_sets)
.collect(),
)
}
}
impl IntoIterator for StorageRootTargets {
type Item = (B256, PrefixSet);
type IntoIter = std::collections::hash_map::IntoIter<B256, PrefixSet>;
fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}
impl rayon::iter::IntoParallelIterator for StorageRootTargets {
type Iter = rayon::collections::hash_map::IntoIter<B256, PrefixSet>;
type Item = (B256, PrefixSet);
fn into_par_iter(self) -> Self::Iter {
self.0.into_par_iter()
}
}