[][src]Enum gf::support::lattice::PosetLattice

pub enum PosetLattice<T> {
    Bottom,
    Top,
    Value(T),
}

Lattice constructed from a partially ordered set by adding dedicated bottom and top elements.

Example

This example uses PosetLattice to calculate minimum and maximum of two integers.

let a = PosetLattice::from(10u32);
let b = PosetLattice::from(20u32);

// Normal elements compare according to their `PartialOrd`.
assert_eq!(Meet::meet(&a, &b), a);
assert_eq!(Join::join(&a, &b), b);

// Bottom is less and top is greater than anything else.
assert_eq!(Meet::meet(&PosetLattice::Bottom, &a), PosetLattice::Bottom);
assert_eq!(Meet::meet(&PosetLattice::Top, &a), a);

Variants

Bottom

Dedicated bottom element, ⊥.

Top

Dedicated top element, ⊤.

Value(T)

Normal element.

Implementations

impl<T> PosetLattice<T>[src]

pub fn as_ref(&self) -> PosetLattice<&T>[src]

Convert from a &PosetLattice<T> to PosetLattice<&T>.

pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> PosetLattice<U>[src]

Map normal elements using f, while preserving dedicated bottom and top elements.

pub fn and_then<U, F: FnOnce(T) -> PosetLattice<U>>(
    self,
    f: F
) -> PosetLattice<U>
[src]

Map normal elements using f which may also return bottom or top, while preserving bottom and top elements.

impl<'a, T: Clone> PosetLattice<&'a T>[src]

pub fn cloned(self) -> PosetLattice<T>[src]

Convert from a &PosetLattice<T> to PosetLattice<T> by cloning the element.

impl<'a, T: Copy> PosetLattice<&'a T>[src]

pub fn copied(self) -> PosetLattice<T>[src]

Convert from a &PosetLattice<T> to PosetLattice<T> by copying the element.

Trait Implementations

impl<T: Eq> Bottom for PosetLattice<T>[src]

impl<T: Clone> Clone for PosetLattice<T>[src]

impl<T: Copy> Copy for PosetLattice<T>[src]

impl<T: Debug> Debug for PosetLattice<T>[src]

impl<T: Eq> Eq for PosetLattice<T>[src]

impl<T> From<T> for PosetLattice<T>[src]

impl<T: Hash> Hash for PosetLattice<T>[src]

impl<T: Clone + Eq + PartialOrd> Join for PosetLattice<T>[src]

impl<T: Clone + Eq + PartialOrd> Meet for PosetLattice<T>[src]

impl<T: PartialEq> PartialEq<PosetLattice<T>> for PosetLattice<T>[src]

impl<T> StructuralEq for PosetLattice<T>[src]

impl<T> StructuralPartialEq for PosetLattice<T>[src]

impl<T: Eq> Top for PosetLattice<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for PosetLattice<T> where
    T: RefUnwindSafe

impl<T> Send for PosetLattice<T> where
    T: Send

impl<T> Sync for PosetLattice<T> where
    T: Sync

impl<T> Unpin for PosetLattice<T> where
    T: Unpin

impl<T> UnwindSafe for PosetLattice<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<!> for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.