pub trait Lattice: PartialOrder {
    // Required methods
    fn join(&self, other: &Self) -> Self;
    fn meet(&self, other: &Self) -> Self;

    // Provided methods
    fn join_assign(&mut self, other: &Self)
       where Self: Sized { ... }
    fn meet_assign(&mut self, other: &Self)
       where Self: Sized { ... }
    fn advance_by(&mut self, frontier: AntichainRef<'_, Self>)
       where Self: Sized { ... }
}
Expand description

A bounded partially ordered type supporting joins and meets.

Required Methods§

source

fn join(&self, other: &Self) -> Self

The smallest element greater than or equal to both arguments.

§Examples

let time1 = Product::new(3, 7);
let time2 = Product::new(4, 6);
let join = time1.join(&time2);

assert_eq!(join, Product::new(4, 7));
source

fn meet(&self, other: &Self) -> Self

The largest element less than or equal to both arguments.

§Examples

let time1 = Product::new(3, 7);
let time2 = Product::new(4, 6);
let meet = time1.meet(&time2);

assert_eq!(meet, Product::new(3, 6));

Provided Methods§

source

fn join_assign(&mut self, other: &Self)
where Self: Sized,

Updates self to the smallest element greater than or equal to both arguments.

§Examples

let mut time1 = Product::new(3, 7);
let time2 = Product::new(4, 6);
time1.join_assign(&time2);

assert_eq!(time1, Product::new(4, 7));
source

fn meet_assign(&mut self, other: &Self)
where Self: Sized,

Updates self to the largest element less than or equal to both arguments.

§Examples

let mut time1 = Product::new(3, 7);
let time2 = Product::new(4, 6);
time1.meet_assign(&time2);

assert_eq!(time1, Product::new(3, 6));
source

fn advance_by(&mut self, frontier: AntichainRef<'_, Self>)
where Self: Sized,

Advances self to the largest time indistinguishable under frontier.

This method produces the “largest” lattice element with the property that for every lattice element greater than some element of frontier, both the result and self compare identically to the lattice element. The result is the “largest” element in the sense that any other element with the same property (compares identically to times greater or equal to frontier) must be less or equal to the result.

When provided an empty frontier self is not modified.

§Examples

use timely::progress::frontier::{Antichain, AntichainRef};

let time = Product::new(3, 7);
let mut advanced = Product::new(3, 7);
let frontier = Antichain::from(vec![Product::new(4, 8), Product::new(5, 3)]);
advanced.advance_by(frontier.borrow());

// `time` and `advanced` are indistinguishable to elements >= an element of `frontier`
for i in 0 .. 10 {
    for j in 0 .. 10 {
        let test = Product::new(i, j);
        // for `test` in the future of `frontier` ..
        if frontier.less_equal(&test) {
            assert_eq!(time.less_equal(&test), advanced.less_equal(&test));
        }
    }
}

assert_eq!(advanced, Product::new(4, 7));

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Lattice for i8

source§

fn join(&self, other: &Self) -> Self

source§

fn meet(&self, other: &Self) -> Self

source§

impl Lattice for i16

source§

fn join(&self, other: &Self) -> Self

source§

fn meet(&self, other: &Self) -> Self

source§

impl Lattice for i32

source§

fn join(&self, other: &Self) -> Self

source§

fn meet(&self, other: &Self) -> Self

source§

impl Lattice for i64

source§

fn join(&self, other: &Self) -> Self

source§

fn meet(&self, other: &Self) -> Self

source§

impl Lattice for i128

source§

fn join(&self, other: &Self) -> Self

source§

fn meet(&self, other: &Self) -> Self

source§

impl Lattice for isize

source§

fn join(&self, other: &Self) -> Self

source§

fn meet(&self, other: &Self) -> Self

source§

impl Lattice for u8

source§

fn join(&self, other: &Self) -> Self

source§

fn meet(&self, other: &Self) -> Self

source§

impl Lattice for u16

source§

fn join(&self, other: &Self) -> Self

source§

fn meet(&self, other: &Self) -> Self

source§

impl Lattice for u32

source§

fn join(&self, other: &Self) -> Self

source§

fn meet(&self, other: &Self) -> Self

source§

impl Lattice for u64

source§

fn join(&self, other: &Self) -> Self

source§

fn meet(&self, other: &Self) -> Self

source§

impl Lattice for u128

source§

fn join(&self, other: &Self) -> Self

source§

fn meet(&self, other: &Self) -> Self

source§

impl Lattice for ()

source§

fn join(&self, other: &Self) -> Self

source§

fn meet(&self, other: &Self) -> Self

source§

impl Lattice for usize

source§

fn join(&self, other: &Self) -> Self

source§

fn meet(&self, other: &Self) -> Self

source§

impl Lattice for Duration

source§

fn join(&self, other: &Self) -> Self

source§

fn meet(&self, other: &Self) -> Self

source§

impl<T1: Lattice + Clone, T2: Lattice + Clone + Maximum + Timestamp> Lattice for (T1, T2)

source§

fn join(&self, other: &(T1, T2)) -> (T1, T2)

source§

fn meet(&self, other: &(T1, T2)) -> (T1, T2)

source§

impl<T1: Lattice, T2: Lattice> Lattice for Product<T1, T2>

source§

fn join(&self, other: &Product<T1, T2>) -> Product<T1, T2>

source§

fn meet(&self, other: &Product<T1, T2>) -> Product<T1, T2>

source§

impl<T: Lattice + Clone> Lattice for Antichain<T>

source§

fn join(&self, other: &Self) -> Self

source§

fn meet(&self, other: &Self) -> Self

Implementors§