pub struct ProtocolStateDelta {
pub component_id: String,
pub updated_attributes: HashMap<String, Bytes>,
pub deleted_attributes: HashSet<String>,
}Expand description
Represents a change in protocol state.
Fields§
§component_id: String§updated_attributes: HashMap<String, Bytes>§deleted_attributes: HashSet<String>Implementations§
Source§impl ProtocolStateDelta
impl ProtocolStateDelta
Sourcepub fn merge(&mut self, other: &Self)
pub fn merge(&mut self, other: &Self)
Merges ‘other’ into ‘self’.
During merge of these deltas a special situation can arise when an attribute is present in
self.deleted_attributes and `other.update_attributes``. If we would just merge the sets
of deleted attributes or vice versa, it would be ambiguous and potential lead to a
deletion of an attribute that should actually be present, or retention of an actually
deleted attribute.
This situation is handled the following way:
- If an attribute is deleted and in the next message recreated, it is removed from the
set of deleted attributes and kept in updated_attributes. This way it's temporary
deletion is never communicated to the final receiver.
- If an attribute was updated and is deleted in the next message, it is removed from
updated attributes and kept in deleted. This way the attributes temporary update (or
potentially short-lived existence) before its deletion is never communicated to the
final receiver.Trait Implementations§
Source§impl Clone for ProtocolStateDelta
impl Clone for ProtocolStateDelta
Source§fn clone(&self) -> ProtocolStateDelta
fn clone(&self) -> ProtocolStateDelta
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 ProtocolStateDelta
impl Debug for ProtocolStateDelta
Source§impl Default for ProtocolStateDelta
impl Default for ProtocolStateDelta
Source§fn default() -> ProtocolStateDelta
fn default() -> ProtocolStateDelta
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ProtocolStateDelta
impl<'de> Deserialize<'de> for ProtocolStateDelta
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<ProtocolComponentStateDelta> for ProtocolStateDelta
impl From<ProtocolComponentStateDelta> for ProtocolStateDelta
Source§fn from(value: ProtocolComponentStateDelta) -> Self
fn from(value: ProtocolComponentStateDelta) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ProtocolStateDelta
impl PartialEq for ProtocolStateDelta
Source§impl Serialize for ProtocolStateDelta
impl Serialize for ProtocolStateDelta
Source§impl<'__s> ToSchema<'__s> for ProtocolStateDelta
impl<'__s> ToSchema<'__s> for ProtocolStateDelta
impl StructuralPartialEq for ProtocolStateDelta
Auto Trait Implementations§
impl Freeze for ProtocolStateDelta
impl RefUnwindSafe for ProtocolStateDelta
impl Send for ProtocolStateDelta
impl Sync for ProtocolStateDelta
impl Unpin for ProtocolStateDelta
impl UnwindSafe for ProtocolStateDelta
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