mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-04 17:27:23 +00:00
Add append api and use it to deposit events (#5795)
* use append api to deposit events * use optimized append * one more optimization * fix bug * fix issues * address review
This commit is contained in:
@@ -223,6 +223,13 @@ impl OverlayedChanges {
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns mutable reference to either commited or propsective value.
|
||||
pub fn value_mut(&mut self, key: &[u8]) -> Option<&mut Option<StorageValue>> {
|
||||
// not using map because of double borrow inside closure
|
||||
if let Some(entry) = self.prospective.top.get_mut(key) { return Some(&mut entry.value) }
|
||||
return self.committed.top.get_mut(key).map(|entry| &mut entry.value);
|
||||
}
|
||||
|
||||
/// Returns a double-Option: None if the key is unknown (i.e. and the query should be referred
|
||||
/// to the backend); Some(None) if the key has been deleted. Some(Some(...)) for a key whose
|
||||
/// value has been set.
|
||||
|
||||
Reference in New Issue
Block a user