add a bit clarification to HashDB's remove() interface
This commit is contained in:
parent
3111421866
commit
4efd673c19
@ -86,7 +86,7 @@ pub trait HashDB: AsHashDB + Send + Sync {
|
|||||||
fn emplace(&mut self, key: H256, value: DBValue);
|
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
|
/// 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
|
/// # Examples
|
||||||
/// ```rust
|
/// ```rust
|
||||||
@ -100,6 +100,10 @@ pub trait HashDB: AsHashDB + Send + Sync {
|
|||||||
/// let key = &d.sha3();
|
/// let key = &d.sha3();
|
||||||
/// m.remove(key); // OK - we now owe an insertion.
|
/// m.remove(key); // OK - we now owe an insertion.
|
||||||
/// assert!(!m.contains(key));
|
/// 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.
|
/// m.insert(d); // OK - now it's "empty" again.
|
||||||
/// assert!(!m.contains(key));
|
/// assert!(!m.contains(key));
|
||||||
/// m.insert(d); // OK - now we've
|
/// m.insert(d); // OK - now we've
|
||||||
|
Loading…
Reference in New Issue
Block a user