pub fn delta_trie_root<H: Hasher, I, A, B, DB>(
	db: &mut DB,
	mut root: H::Out,
	delta: I
) -> Result<H::Out, Box<TrieError<H::Out>>> where
	I: IntoIterator<Item = (A, Option<B>)>,
	A: AsRef<[u8]> + Ord,
	B: AsRef<[u8]>,
	DB: hash_db::HashDB<H, trie_db::DBValue>,
{
	{
		let mut trie = TrieDBMut::<H>::from_existing(&mut *db, &mut root)?;

		for (key, change) in delta {
			match change {
				Some(val) => trie.insert(key.as_ref(), val.as_ref())?,
				None => trie.remove(key.as_ref())?,
			};
		}
	}

	Ok(root)
}
/// Determine a trie root given a hash DB and delta values.
Determine a trie root given a hash DB and delta values.
Determine a trie root given a hash DB and delta values .
pub fn delta_trie_root<H: Hasher, I, A, B, DB>(
	db: &mut DB,
	mut root: H::Out,
	delta: I
) -> Result<H::Out, Box<TrieError<H::Out>>> where
	I: IntoIterator<Item = (A, Option<B>)>,
	A: AsRef<[u8]> + Ord,
	B: AsRef<[u8]>,
	DB: hash_db::HashDB<H, trie_db::DBValue>,
{
	{
		let mut trie = TrieDBMut::<H>::from_existing(&mut *db, &mut root)?;
		for (key, change) in delta {
			match change {
				Some(val) => trie.insert(key.as_ref(), val.as_ref())?,
				None => trie.remove(key.as_ref())?,
			};
		}
	}
	Ok(root)
}
pub fn delta_trie_root < H : Hasher , I , A , B , DB > ( db : & mut DB , mut root : H :: Out , delta : I ) -> Result < H :: Out , Box < TrieError < H :: Out > > > where I : IntoIterator < Item = ( A , Option < B > ) > , A : AsRef < [ u8 ] > + Ord , B : AsRef < [ u8 ] > , DB : hash_db :: HashDB < H , trie_db :: DBValue > , { { let mut trie = TrieDBMut :: < H > :: from_existing ( & mut * db , & mut root ) ? ; for ( key , change ) in delta { match change { Some ( val ) => trie . insert ( key . as_ref ( ) , val . as_ref ( ) ) ? , None => trie . remove ( key . as_ref ( ) ) ? , } ; } } Ok ( root ) }
Determine a trie root given a hash DB and delta values.
Determine a trie root given a hash DB and delta values .
db
&mut DB
root
H::Out
delta
I
db
&mut DB
root
H::Out
delta
I