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

pub enum FlatLattice<T> {
    Bottom,
    Top,
    Inner(T),
}

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

Example

This example uses FlatLattice to reason about integer values, like in an integer constant propagation pass.

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

assert_eq!(Meet::meet(&a, &a), a);
assert_eq!(Meet::meet(&a, &b), FlatLattice::Bottom);
assert_eq!(Join::join(&a, &a), a);
assert_eq!(Join::join(&a, &b), FlatLattice::Top);

Variants

Bottom

Dedicated bottom element, ⊥.

Top

Dedicated top element, ⊤.

Inner(T)

Inner element.

Implementations

impl<T> FlatLattice<T>[src]

pub fn from_vec(vec: Vec<FlatLattice<T>>) -> FlatLattice<Vec<T>>[src]

Convert from a Vec<FlatLattice<T>> to FlatLattice<Vec<T>>.

If the vector contains a ⊥, the result is also ⊥. Otherwise, if the vector contains a ⊤, the result is also ⊤. Otherwise, the result is an inner element.

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

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

pub fn is_inner(&self) -> bool[src]

Return whether the FlatLattice contains an inner element.

pub fn unwrap(self) -> T[src]

Unwrap an inner element.

Errors

  • Panics if FlatLattice contains a bottom element.
  • Panics if FlatLattice contains a top element.

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

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

pub fn map_bottom<F: FnOnce() -> Self>(self, f: F) -> Self[src]

Map bottom elements using f, while preserving inner and top elements.

pub fn map_top<F: FnOnce() -> Self>(self, f: F) -> Self[src]

Map top elements using f, while preserving inner and bottom elements.

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

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

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

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

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

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

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

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

Trait Implementations

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

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

impl<A: IntoU128> ConstSpaceState<A, FlatLattice<BitVec>> for ConcreteSpaceState[src]

impl<A: IntoU128> ConstSpaceState<A, FlatLattice<Expr>> for SymbolicSpaceState[src]

impl ConstSpaceState<BitVec, FlatLattice<BitVec>> for ConcreteSpaceState[src]

impl ConstSpaceState<BitVec, FlatLattice<Expr>> for SymbolicSpaceState[src]

impl ConstSpaceState<FlatLattice<BitVec>, FlatLattice<BitVec>> for ConcreteSpaceState[src]

impl ConstSpaceState<FlatLattice<BitVec>, FlatLattice<Expr>> for SymbolicSpaceState[src]

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

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

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

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

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

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

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

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

impl<A: IntoU128> SpaceState<A, FlatLattice<BitVec>> for ConcreteSpaceState[src]

impl<A: IntoU128> SpaceState<A, FlatLattice<Expr>> for SymbolicSpaceState[src]

impl SpaceState<BitVec, FlatLattice<BitVec>> for ConcreteSpaceState[src]

impl SpaceState<BitVec, FlatLattice<Expr>> for SymbolicSpaceState[src]

impl SpaceState<FlatLattice<BitVec>, FlatLattice<BitVec>> for ConcreteSpaceState[src]

impl SpaceState<FlatLattice<BitVec>, FlatLattice<Expr>> for SymbolicSpaceState[src]

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

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

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

impl<T: Clone + Eq + Ord> ValueSet<T> for FlatLattice<T>[src]

Auto Trait Implementations

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

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

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

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

impl<T> UnwindSafe for FlatLattice<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.