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

    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§

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));

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§

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));

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));

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));

Implementations on Foreign Types§

Implementors§