From 4efd673c19daaa51e371c2662fdc1401aa0cdd8e Mon Sep 17 00:00:00 2001 From: Guanqun Lu Date: Sat, 27 May 2017 11:32:49 +0800 Subject: [PATCH] add a bit clarification to HashDB's remove() interface --- util/src/hashdb.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/util/src/hashdb.rs b/util/src/hashdb.rs index 8217413ef..ca4120702 100644 --- a/util/src/hashdb.rs +++ b/util/src/hashdb.rs @@ -86,7 +86,7 @@ pub trait HashDB: AsHashDB + Send + Sync { fn emplace(&mut self, key: H256, value: DBValue); /// Remove a datum previously inserted. Insertions can be "owed" such that the same number of `insert()`s may - /// happen without the data being eventually being inserted into the DB. + /// happen without the data being eventually being inserted into the DB. It can be "owed" more than once. /// /// # Examples /// ```rust @@ -100,6 +100,10 @@ pub trait HashDB: AsHashDB + Send + Sync { /// let key = &d.sha3(); /// m.remove(key); // OK - we now owe an insertion. /// assert!(!m.contains(key)); + /// m.remove(key); // OK - we now owe two insertions. + /// assert!(!m.contains(key)); + /// m.insert(d); // OK - still owed. + /// assert!(!m.contains(key)); /// m.insert(d); // OK - now it's "empty" again. /// assert!(!m.contains(key)); /// m.insert(d); // OK - now we've