pub fn for_keys_with_prefix<F: FnMut(&[u8])>(&self, prefix: &[u8], mut f: F) {
		let mut read_overlay = S::Overlay::default();
		let eph = Ephemeral {
			storage: &self.storage,
			overlay: &mut read_overlay,
		};

		let mut iter = move || -> Result<(), Box<TrieError<H::Out>>> {
			let trie = TrieDB::<H>::new(&eph, &self.root)?;
			let mut iter = trie.iter()?;

			iter.seek(prefix)?;

			for x in iter {
				let (key, _) = x?;

				if !key.starts_with(prefix) {
					break;
				}

				f(&key);
			}

			Ok(())
		};

		if let Err(e) = iter() {
			debug!(target: "trie", "Error while iterating by prefix: {}", e);
		}
	}
/// Execute given closure for all keys starting with prefix.
Execute given closure for all keys starting with prefix.
Execute given closure for all keys starting with prefix .
pub fn for_keys_with_prefix<F: FnMut(&[u8])>(&self, prefix: &[u8], mut f: F) {
		let mut read_overlay = S::Overlay::default();
		let eph = Ephemeral {
			storage: &self.storage,
			overlay: &mut read_overlay,
		};
		let mut iter = move || -> Result<(), Box<TrieError<H::Out>>> {
			let trie = TrieDB::<H>::new(&eph, &self.root)?;
			let mut iter = trie.iter()?;
			iter.seek(prefix)?;
			for x in iter {
				let (key, _) = x?;
				if !key.starts_with(prefix) {
					break;
				}
				f(&key);
			}
			Ok(())
		};
		if let Err(e) = iter() {
			debug!(target: "trie", "Error while iterating by prefix: {}", e);
		}
	}
pub fn for_keys_with_prefix < F : FnMut ( & [ u8 ] ) > ( & self , prefix : & [ u8 ] , mut f : F ) { let mut read_overlay = S :: Overlay :: default ( ) ; let eph = Ephemeral { storage : & self . storage , overlay : & mut read_overlay , } ; let mut iter = move | | -> Result < ( ) , Box < TrieError < H :: Out > > > { let trie = TrieDB :: < H > :: new ( & eph , & self . root ) ? ; let mut iter = trie . iter ( ) ? ; iter . seek ( prefix ) ? ; for x in iter { let ( key , _ ) = x ? ; if ! key . starts_with ( prefix ) { break ; } f ( & key ) ; } Ok ( ( ) ) } ; if let Err ( e ) = iter ( ) { debug ! ( target " " " " e ) ; } }
Execute given closure for all keys starting with prefix.
Execute given closure for all keys starting with prefix .
&self
prefix
&[u8]
f
F
&self
prefix
&[u8]
f
F