Fixing compilation&clippy warnings (#1531)
* Fixing compilation&clippy warnings * Adding spaces
This commit is contained in:
parent
bb36a594c5
commit
bb2a631885
@ -18,6 +18,7 @@ use hash::H256;
|
|||||||
use sha3::Hashable;
|
use sha3::Hashable;
|
||||||
use hashdb::HashDB;
|
use hashdb::HashDB;
|
||||||
use super::{TrieDB, Trie, TrieDBIterator, TrieError};
|
use super::{TrieDB, Trie, TrieDBIterator, TrieError};
|
||||||
|
use trie::trietraits::TrieItem;
|
||||||
|
|
||||||
/// A `Trie` implementation which hashes keys and uses a generic `HashDB` backing database.
|
/// A `Trie` implementation which hashes keys and uses a generic `HashDB` backing database.
|
||||||
/// Additionaly it stores inserted hash-key mappings for later retrieval.
|
/// Additionaly it stores inserted hash-key mappings for later retrieval.
|
||||||
@ -51,7 +52,7 @@ impl<'db> FatDB<'db> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'db> Trie for FatDB<'db> {
|
impl<'db> Trie for FatDB<'db> {
|
||||||
fn iter<'a>(&'a self) -> Box<Iterator<Item = (Vec<u8>, &[u8])> + 'a> {
|
fn iter<'a>(&'a self) -> Box<Iterator<Item = TrieItem> + 'a> {
|
||||||
Box::new(FatDB::iter(self))
|
Box::new(FatDB::iter(self))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
use hash::H256;
|
use hash::H256;
|
||||||
use sha3::Hashable;
|
use sha3::Hashable;
|
||||||
use hashdb::HashDB;
|
use hashdb::HashDB;
|
||||||
use super::{TrieDBMut, Trie, TrieMut, TrieError};
|
use super::{TrieDBMut, TrieMut, TrieError};
|
||||||
|
|
||||||
/// A mutable `Trie` implementation which hashes keys and uses a generic `HashDB` backing database.
|
/// A mutable `Trie` implementation which hashes keys and uses a generic `HashDB` backing database.
|
||||||
/// Additionaly it stores inserted hash-key mappings for later retrieval.
|
/// Additionaly it stores inserted hash-key mappings for later retrieval.
|
||||||
@ -82,6 +82,7 @@ impl<'db> TrieMut for FatDBMut<'db> {
|
|||||||
fn fatdb_to_trie() {
|
fn fatdb_to_trie() {
|
||||||
use memorydb::MemoryDB;
|
use memorydb::MemoryDB;
|
||||||
use super::TrieDB;
|
use super::TrieDB;
|
||||||
|
use super::Trie;
|
||||||
|
|
||||||
let mut memdb = MemoryDB::new();
|
let mut memdb = MemoryDB::new();
|
||||||
let mut root = H256::default();
|
let mut root = H256::default();
|
||||||
|
@ -86,6 +86,7 @@ pub struct TrieFactory {
|
|||||||
spec: TrieSpec,
|
spec: TrieSpec,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature="dev", allow(wrong_self_convention))]
|
||||||
impl TrieFactory {
|
impl TrieFactory {
|
||||||
/// Creates new factory.
|
/// Creates new factory.
|
||||||
pub fn new(spec: TrieSpec) -> Self {
|
pub fn new(spec: TrieSpec) -> Self {
|
||||||
|
@ -18,7 +18,7 @@ use hash::H256;
|
|||||||
use sha3::Hashable;
|
use sha3::Hashable;
|
||||||
use hashdb::HashDB;
|
use hashdb::HashDB;
|
||||||
use super::triedb::TrieDB;
|
use super::triedb::TrieDB;
|
||||||
use super::trietraits::Trie;
|
use super::trietraits::{Trie, TrieItem};
|
||||||
use super::TrieError;
|
use super::TrieError;
|
||||||
|
|
||||||
/// A `Trie` implementation which hashes keys and uses a generic `HashDB` backing database.
|
/// A `Trie` implementation which hashes keys and uses a generic `HashDB` backing database.
|
||||||
@ -50,7 +50,7 @@ impl<'db> SecTrieDB<'db> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'db> Trie for SecTrieDB<'db> {
|
impl<'db> Trie for SecTrieDB<'db> {
|
||||||
fn iter<'a>(&'a self) -> Box<Iterator<Item = (Vec<u8>, &[u8])> + 'a> {
|
fn iter<'a>(&'a self) -> Box<Iterator<Item = TrieItem> + 'a> {
|
||||||
Box::new(TrieDB::iter(&self.raw))
|
Box::new(TrieDB::iter(&self.raw))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ use hash::H256;
|
|||||||
use sha3::Hashable;
|
use sha3::Hashable;
|
||||||
use hashdb::HashDB;
|
use hashdb::HashDB;
|
||||||
use super::triedbmut::TrieDBMut;
|
use super::triedbmut::TrieDBMut;
|
||||||
use super::trietraits::{Trie, TrieMut};
|
use super::trietraits::TrieMut;
|
||||||
use super::TrieError;
|
use super::TrieError;
|
||||||
|
|
||||||
/// A mutable `Trie` implementation which hashes keys and uses a generic `HashDB` backing database.
|
/// A mutable `Trie` implementation which hashes keys and uses a generic `HashDB` backing database.
|
||||||
@ -74,6 +74,7 @@ impl<'db> TrieMut for SecTrieDBMut<'db> {
|
|||||||
fn sectrie_to_trie() {
|
fn sectrie_to_trie() {
|
||||||
use memorydb::*;
|
use memorydb::*;
|
||||||
use super::triedb::*;
|
use super::triedb::*;
|
||||||
|
use super::Trie;
|
||||||
|
|
||||||
let mut memdb = MemoryDB::new();
|
let mut memdb = MemoryDB::new();
|
||||||
let mut root = H256::default();
|
let mut root = H256::default();
|
||||||
|
@ -18,7 +18,7 @@ use common::*;
|
|||||||
use hashdb::*;
|
use hashdb::*;
|
||||||
use nibbleslice::*;
|
use nibbleslice::*;
|
||||||
use rlp::*;
|
use rlp::*;
|
||||||
use super::trietraits::{Trie};
|
use super::trietraits::{Trie, TrieItem};
|
||||||
use super::node::Node;
|
use super::node::Node;
|
||||||
use super::TrieError;
|
use super::TrieError;
|
||||||
|
|
||||||
@ -337,7 +337,7 @@ impl<'db> TrieDB<'db> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'db> Trie for TrieDB<'db> {
|
impl<'db> Trie for TrieDB<'db> {
|
||||||
fn iter<'a>(&'a self) -> Box<Iterator<Item = (Vec<u8>, &[u8])> + 'a> {
|
fn iter<'a>(&'a self) -> Box<Iterator<Item = TrieItem> + 'a> {
|
||||||
Box::new(TrieDB::iter(self))
|
Box::new(TrieDB::iter(self))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ use nibbleslice::*;
|
|||||||
use rlp::*;
|
use rlp::*;
|
||||||
use super::node::Node;
|
use super::node::Node;
|
||||||
use super::journal::Journal;
|
use super::journal::Journal;
|
||||||
use super::trietraits::{Trie, TrieMut};
|
use super::trietraits::TrieMut;
|
||||||
use super::TrieError;
|
use super::TrieError;
|
||||||
|
|
||||||
/// A `Trie` implementation using a generic `HashDB` backing database.
|
/// A `Trie` implementation using a generic `HashDB` backing database.
|
||||||
|
@ -17,6 +17,9 @@
|
|||||||
use hash::H256;
|
use hash::H256;
|
||||||
use rlp::SHA3_NULL_RLP;
|
use rlp::SHA3_NULL_RLP;
|
||||||
|
|
||||||
|
/// Trie-Item type.
|
||||||
|
pub type TrieItem<'a> = (Vec<u8>, &'a[u8]);
|
||||||
|
|
||||||
/// A key-value datastore implemented as a database-backed modified Merkle tree.
|
/// A key-value datastore implemented as a database-backed modified Merkle tree.
|
||||||
pub trait Trie {
|
pub trait Trie {
|
||||||
/// Return the root of the trie.
|
/// Return the root of the trie.
|
||||||
@ -32,7 +35,7 @@ pub trait Trie {
|
|||||||
fn get<'a, 'key>(&'a self, key: &'key [u8]) -> Option<&'a [u8]> where 'a: 'key;
|
fn get<'a, 'key>(&'a self, key: &'key [u8]) -> Option<&'a [u8]> where 'a: 'key;
|
||||||
|
|
||||||
/// Returns an iterator over elements of trie.
|
/// Returns an iterator over elements of trie.
|
||||||
fn iter<'a>(&'a self) -> Box<Iterator<Item = (Vec<u8>, &[u8])> + 'a>;
|
fn iter<'a>(&'a self) -> Box<Iterator<Item = TrieItem> + 'a>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A key-value datastore implemented as a database-backed modified Merkle tree.
|
/// A key-value datastore implemented as a database-backed modified Merkle tree.
|
||||||
|
Loading…
Reference in New Issue
Block a user