Struct lattices::DomPair

source ·
pub struct DomPair<Key, Val> {
    pub key: Key,
    /* private fields */
}
Expand description

Dominating pair compound lattice.

When merging if one Key (usually a timestamp) fully dominates (is greater than) the other, then both that Key and corresponding Val are selected. If the Keys are equal or incomparable, then both the Keys and Vals are merged.

Key specifies the key lattice (usually a timestamp), and Val specifies the value lattice.

Note that this is not a proper lattice, it fails associativity. However it will behave like a proper lattice if Key is a totally ordered lattice or a properly formed vector clock lattice. The exact meaning of “properly formed” is still TBD, but each node always incrementing its entry for each operation sent should be sufficient.

Fields§

§key: Key

The Key of the dominating pair lattice, usually a timestamp.

This field is public as it is always monotonically increasing in its lattice.

Implementations§

source§

impl<Key, Val> DomPair<Key, Val>

source

pub fn new(key: Key, val: Val) -> Self

Create a DomPair from the given Key and Val.

source

pub fn new_from(key: impl Into<Key>, val: impl Into<Val>) -> Self

Create a DomPair from the given Into<Key> and Into<Val>.

source

pub fn as_reveal_ref(&self) -> (&Key, &Val)

Reveal the inner value as a shared reference.

source

pub fn as_reveal_mut(&mut self) -> (&mut Key, &mut Val)

Reveal the inner value as an exclusive reference.

source

pub fn into_reveal(self) -> (Key, Val)

Gets the inner by value, consuming self.

Trait Implementations§

source§

impl<Key: Clone, Val: Clone> Clone for DomPair<Key, Val>

source§

fn clone(&self) -> DomPair<Key, Val>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<Key: Debug, Val: Debug> Debug for DomPair<Key, Val>

source§

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

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

impl<Key, Val> DeepReveal for DomPair<Key, Val>
where Key: DeepReveal, Val: DeepReveal,

§

type Revealed = (<Key as DeepReveal>::Revealed, <Val as DeepReveal>::Revealed)

The underlying type when revealed.
source§

fn deep_reveal(self) -> Self::Revealed

Reveals the underlying lattice types recursively.
source§

impl<Key: Default, Val: Default> Default for DomPair<Key, Val>

source§

fn default() -> DomPair<Key, Val>

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

impl<'de, Key, Val> Deserialize<'de> for DomPair<Key, Val>
where Key: Deserialize<'de>, Val: 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<Key, Val> IsBot for DomPair<Key, Val>
where Key: IsBot, Val: IsBot,

source§

fn is_bot(&self) -> bool

Returns if self is lattice bottom (⊥). Read more
source§

impl<Key, Val> IsTop for DomPair<Key, Val>
where Key: IsTop, Val: IsTop,

source§

fn is_top(&self) -> bool

Returns if self is lattice top (⊤). Read more
source§

impl<KeySelf, KeyOther, ValSelf, ValOther> LatticeFrom<DomPair<KeyOther, ValOther>> for DomPair<KeySelf, ValSelf>
where KeySelf: LatticeFrom<KeyOther>, ValSelf: LatticeFrom<ValOther>,

source§

fn lattice_from(other: DomPair<KeyOther, ValOther>) -> Self

Convert from the Other lattice into Self.
source§

impl<KeySelf, KeyOther, ValSelf, ValOther> Merge<DomPair<KeyOther, ValOther>> for DomPair<KeySelf, ValSelf>
where KeySelf: Merge<KeyOther> + LatticeFrom<KeyOther> + PartialOrd<KeyOther>, ValSelf: Merge<ValOther> + LatticeFrom<ValOther>,

source§

fn merge(&mut self, other: DomPair<KeyOther, ValOther>) -> bool

Merge other into the self lattice. Read more
source§

fn merge_owned(this: Self, delta: Other) -> Self
where Self: Sized,

Merge this and delta together, returning the new value.
source§

impl<KeySelf, KeyOther, ValSelf, ValOther> PartialEq<DomPair<KeyOther, ValOther>> for DomPair<KeySelf, ValSelf>
where KeySelf: PartialEq<KeyOther>, ValSelf: PartialEq<ValOther>,

source§

fn eq(&self, other: &DomPair<KeyOther, ValOther>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<KeySelf, KeyOther, ValSelf, ValOther> PartialOrd<DomPair<KeyOther, ValOther>> for DomPair<KeySelf, ValSelf>
where KeySelf: PartialOrd<KeyOther>, ValSelf: PartialOrd<ValOther>,

source§

fn partial_cmp(&self, other: &DomPair<KeyOther, ValOther>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<Key, Val> Serialize for DomPair<Key, Val>
where Key: Serialize, Val: 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<Key: Copy, Val: Copy> Copy for DomPair<Key, Val>

source§

impl<Key: Eq, Val: Eq> Eq for DomPair<Key, Val>

source§

impl<KeySelf, KeyOther, ValSelf, ValOther> LatticeOrd<DomPair<KeyOther, ValOther>> for DomPair<KeySelf, ValSelf>
where Self: PartialOrd<DomPair<KeyOther, ValOther>>,

Auto Trait Implementations§

§

impl<Key, Val> Freeze for DomPair<Key, Val>
where Key: Freeze, Val: Freeze,

§

impl<Key, Val> RefUnwindSafe for DomPair<Key, Val>
where Key: RefUnwindSafe, Val: RefUnwindSafe,

§

impl<Key, Val> Send for DomPair<Key, Val>
where Key: Send, Val: Send,

§

impl<Key, Val> Sync for DomPair<Key, Val>
where Key: Sync, Val: Sync,

§

impl<Key, Val> Unpin for DomPair<Key, Val>
where Key: Unpin, Val: Unpin,

§

impl<Key, Val> UnwindSafe for DomPair<Key, Val>
where Key: UnwindSafe, Val: UnwindSafe,

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> 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<This, Other> NaiveLatticeOrd<Other> for This
where This: Clone + Merge<Other>, Other: Clone + Merge<This>,

source§

fn naive_cmp(&self, other: &Rhs) -> Option<Ordering>

Naive compare based on the Merge::merge method. This method can be very inefficient; use PartialOrd::partial_cmp instead. Read more
source§

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

§

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>,

§

type Error = Infallible

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>,

§

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.
source§

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

source§

impl<T> Lattice for T