File tree Expand file tree Collapse file tree 2 files changed +5
-17
lines changed Expand file tree Collapse file tree 2 files changed +5
-17
lines changed Original file line number Diff line number Diff line change @@ -84,22 +84,8 @@ pub trait Trie {
84
84
fn get ( & self , key : & [ u8 ] ) -> Result < Option < DBValue > > ;
85
85
}
86
86
87
- /// A key-value datastore implemented as a database-backed Merkle trie.
88
- pub trait TrieMut {
89
- /// Return the root of the trie.
90
- fn root ( & self ) -> & H256 ;
91
-
92
- /// Is the trie empty?
93
- fn is_empty ( & self ) -> bool ;
94
-
95
- /// Does the trie contain a given key?
96
- fn contains ( & self , key : & [ u8 ] ) -> Result < bool > {
97
- self . get ( key) . map ( |x| x. is_some ( ) )
98
- }
99
-
100
- /// What is the value of the given key in this trie?
101
- fn get ( & self , key : & [ u8 ] ) -> Result < Option < DBValue > > ;
102
-
87
+ /// A key-value datastore implemented as a database-backed modified Merkle tree.
88
+ pub trait TrieMut : Trie {
103
89
/// Insert a `key`/`value` pair into the trie. An empty value is equivalent to removing
104
90
/// `key` from the trie. Returns the old value associated with this key, if it existed.
105
91
fn insert ( & mut self , key : & [ u8 ] , value : & [ u8 ] ) -> Result < Option < DBValue > > ;
Original file line number Diff line number Diff line change @@ -297,7 +297,7 @@ impl<'a> fmt::Display for RlpNode<'a> {
297
297
}
298
298
}
299
299
300
- impl < ' a > TrieMut for TrieDBMut < ' a > {
300
+ impl < ' a > Trie for TrieDBMut < ' a > {
301
301
fn root ( & self ) -> & H256 {
302
302
self . root
303
303
}
@@ -311,7 +311,9 @@ impl<'a> TrieMut for TrieDBMut<'a> {
311
311
312
312
t. get ( key)
313
313
}
314
+ }
314
315
316
+ impl < ' a > TrieMut for TrieDBMut < ' a > {
315
317
fn insert ( & mut self , key : & [ u8 ] , value : & [ u8 ] ) -> crate :: Result < Option < DBValue > > {
316
318
let path = blake256 ( key) ;
317
319
let mut old_val = None ;
You can’t perform that action at this time.
0 commit comments