Skip to main content

MapDelta

Struct MapDelta 

Source
pub struct MapDelta<K, V, D> {
    pub add: Vec<(K, V)>,
    pub remove: Vec<K>,
    pub change: Vec<KeyedDelta<K, D>>,
}
Expand description

A keyed diff between two collections of entries.

The three parts are deliberately asymmetric, and that asymmetry is the whole point of the field type: add carries whole entries because the receiver has never seen them, while remove carries bare keys and change carries deltas, because for those the receiver already holds the rest.

Nothing here records position — see SeqDelta for that.

Fields§

§add: Vec<(K, V)>

Entries whose keys are in the new collection but not the old one.

§remove: Vec<K>

Keys that were in the old collection but are not in the new one.

§change: Vec<KeyedDelta<K, D>>

Keys in both collections whose values differ, and how.

Implementations§

Source§

impl<K, V, D> MapDelta<K, V, D>

Source

pub fn is_empty(&self) -> bool

Whether the two collections held the same entries, and so nothing needs sending.

Trait Implementations§

Source§

impl<K: Clone, V: Clone, D: Clone> Clone for MapDelta<K, V, D>

Source§

fn clone(&self) -> MapDelta<K, V, D>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<K: Debug, V: Debug, D: Debug> Debug for MapDelta<K, V, D>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<K, V, D> Default for MapDelta<K, V, D>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, K, V, D> Deserialize<'de> for MapDelta<K, V, D>
where K: Deserialize<'de>, V: Deserialize<'de>, D: Deserialize<'de>,

Source§

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<K: Eq, V: Eq, D: Eq> Eq for MapDelta<K, V, D>

Source§

impl<K: PartialEq, V: PartialEq, D: PartialEq> PartialEq for MapDelta<K, V, D>

Source§

fn eq(&self, other: &MapDelta<K, V, D>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<K, V, D> Serialize for MapDelta<K, V, D>
where K: Serialize, V: Serialize, D: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<K: PartialEq, V: PartialEq, D: PartialEq> StructuralPartialEq for MapDelta<K, V, D>

Auto Trait Implementations§

§

impl<K, V, D> Freeze for MapDelta<K, V, D>
where Vec<(K, V)>: Freeze, Vec<K>: Freeze, Vec<KeyedDelta<K, D>>: Freeze,

§

impl<K, V, D> RefUnwindSafe for MapDelta<K, V, D>

§

impl<K, V, D> Send for MapDelta<K, V, D>
where Vec<(K, V)>: Send, Vec<K>: Send, Vec<KeyedDelta<K, D>>: Send,

§

impl<K, V, D> Sync for MapDelta<K, V, D>
where Vec<(K, V)>: Sync, Vec<K>: Sync, Vec<KeyedDelta<K, D>>: Sync,

§

impl<K, V, D> Unpin for MapDelta<K, V, D>
where Vec<(K, V)>: Unpin, Vec<K>: Unpin, Vec<KeyedDelta<K, D>>: Unpin,

§

impl<K, V, D> UnsafeUnpin for MapDelta<K, V, D>

§

impl<K, V, D> UnwindSafe for MapDelta<K, V, D>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.