pub struct ProtocolChangesWithTx {
pub new_protocol_components: HashMap<ComponentId, ProtocolComponent>,
pub protocol_states: HashMap<ComponentId, ProtocolComponentStateDelta>,
pub balance_changes: HashMap<ComponentId, HashMap<Bytes, ComponentBalance>>,
pub tx: Transaction,
}Expand description
Updates grouped by their respective transaction.
Fields§
§new_protocol_components: HashMap<ComponentId, ProtocolComponent>§protocol_states: HashMap<ComponentId, ProtocolComponentStateDelta>§balance_changes: HashMap<ComponentId, HashMap<Bytes, ComponentBalance>>§tx: TransactionImplementations§
Source§impl ProtocolChangesWithTx
impl ProtocolChangesWithTx
Sourcepub fn merge(&mut self, other: ProtocolChangesWithTx) -> Result<(), MergeError>
pub fn merge(&mut self, other: ProtocolChangesWithTx) -> Result<(), MergeError>
Merges this update with another one.
The method combines two ProtocolStatesWithTx instances under certain
conditions:
- The block from which both updates came should be the same. If the updates are from different blocks, the method will return an error.
- The transactions for each of the updates should be distinct. If they come from the same transaction, the method will return an error.
- The order of the transaction matters. The transaction from
othermust have occurred later than the self transaction. If the self transaction has a higher index thanother, the method will return an error.
The merged update keeps the transaction of other.
§Errors
This method will return an error if any of the above conditions is violated.
Trait Implementations§
Source§impl Clone for ProtocolChangesWithTx
impl Clone for ProtocolChangesWithTx
Source§fn clone(&self) -> ProtocolChangesWithTx
fn clone(&self) -> ProtocolChangesWithTx
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ProtocolChangesWithTx
impl Debug for ProtocolChangesWithTx
Source§impl Default for ProtocolChangesWithTx
impl Default for ProtocolChangesWithTx
Source§fn default() -> ProtocolChangesWithTx
fn default() -> ProtocolChangesWithTx
Returns the “default value” for a type. Read more
Source§impl From<ProtocolChangesWithTx> for TxWithChanges
impl From<ProtocolChangesWithTx> for TxWithChanges
Source§fn from(value: ProtocolChangesWithTx) -> Self
fn from(value: ProtocolChangesWithTx) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ProtocolChangesWithTx
impl PartialEq for ProtocolChangesWithTx
impl StructuralPartialEq for ProtocolChangesWithTx
Auto Trait Implementations§
impl !Freeze for ProtocolChangesWithTx
impl RefUnwindSafe for ProtocolChangesWithTx
impl Send for ProtocolChangesWithTx
impl Sync for ProtocolChangesWithTx
impl Unpin for ProtocolChangesWithTx
impl UnwindSafe for ProtocolChangesWithTx
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more