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 {
8484 fn get ( & self , key : & [ u8 ] ) -> Result < Option < DBValue > > ;
8585}
8686
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 {
10389 /// Insert a `key`/`value` pair into the trie. An empty value is equivalent to removing
10490 /// `key` from the trie. Returns the old value associated with this key, if it existed.
10591 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> {
297297 }
298298}
299299
300- impl < ' a > TrieMut for TrieDBMut < ' a > {
300+ impl < ' a > Trie for TrieDBMut < ' a > {
301301 fn root ( & self ) -> & H256 {
302302 self . root
303303 }
@@ -311,7 +311,9 @@ impl<'a> TrieMut for TrieDBMut<'a> {
311311
312312 t. get ( key)
313313 }
314+ }
314315
316+ impl < ' a > TrieMut for TrieDBMut < ' a > {
315317 fn insert ( & mut self , key : & [ u8 ] , value : & [ u8 ] ) -> crate :: Result < Option < DBValue > > {
316318 let path = blake256 ( key) ;
317319 let mut old_val = None ;
You can’t perform that action at this time.
0 commit comments