Enum satoxid::Lit[][src]

pub enum Lit<V> {
    Pos(V),
    Neg(V),
}
Expand description

Enum to define the polarity of variables. By itself Lit is a constraint, which requires that the variable it wraps is true or false depending on the Variant Pos and Neg.

Example

encoder.add_constraint(Lit::Pos("a"));
encoder.add_constraint(Lit::Neg("b"));

let model = encoder.solve().unwrap();
assert!(model["a"]);
assert!(!model["b"]);

Variants

Pos(V)
Neg(V)

Implementations

impl<V> Lit<V>[src]

pub fn var(&self) -> &V[src]

Returns the underlying variable.

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

Returns the owned underlying variable

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

Returns true if Lit is positive.

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

Returns false if Lit is negative.

Trait Implementations

impl<V: Clone> Clone for Lit<V>[src]

fn clone(&self) -> Lit<V>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<V: Debug> Debug for Lit<V>[src]

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

Formats the value using the given formatter. Read more

impl<V: SatVar> From<Lit<V>> for VarType<V>[src]

fn from(l: Lit<V>) -> Self[src]

Performs the conversion.

impl<V: Hash> Hash for Lit<V>[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl<V> Not for Lit<V>[src]

type Output = Self

The resulting type after applying the ! operator.

fn not(self) -> Self::Output[src]

Performs the unary ! operation. Read more

impl<V: Ord> Ord for Lit<V>[src]

fn cmp(&self, other: &Self) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl<V: PartialEq> PartialEq<Lit<V>> for Lit<V>[src]

fn eq(&self, other: &Lit<V>) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Lit<V>) -> bool[src]

This method tests for !=.

impl<V: PartialOrd> PartialOrd<Lit<V>> for Lit<V>[src]

fn partial_cmp(&self, other: &Self) -> Option<Ordering>[src]

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

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

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

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

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

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

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

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

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

impl<V: Copy> Copy for Lit<V>[src]

impl<V: Eq> Eq for Lit<V>[src]

impl<V> StructuralEq for Lit<V>[src]

impl<V> StructuralPartialEq for Lit<V>[src]

Auto Trait Implementations

impl<V> RefUnwindSafe for Lit<V> where
    V: RefUnwindSafe

impl<V> Send for Lit<V> where
    V: Send

impl<V> Sync for Lit<V> where
    V: Sync

impl<V> Unpin for Lit<V> where
    V: Unpin

impl<V> UnwindSafe for Lit<V> where
    V: UnwindSafe

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<V, L> Constraint<V> for L where
    V: SatVar,
    L: Debug + Clone + Into<VarType<V>>, 
[src]

pub fn encode<B>(Self, &mut B, &mut VarMap<V>) where
    B: Backend
[src]

Encode Self as an constraint using solver.

impl<V, L> ConstraintRepr<V> for L where
    V: SatVar,
    L: Debug + Clone + Into<VarType<V>>, 
[src]

pub fn encode_constraint_implies_repr<B>(
    Self,
    Option<i32>,
    &mut B,
    &mut VarMap<V>
) -> i32 where
    B: Backend
[src]

Encode if Self is satisified, that repr is true. Otherwise repr is not constrained and can be true or false. Read more

pub fn encode_constraint_equals_repr<B>(
    Self,
    Option<i32>,
    &mut B,
    &mut VarMap<V>
) -> i32 where
    B: Backend
[src]

Encode if and only if Self is satisified, that repr is true.

pub fn encode_constraint_repr_cheap<B>(
    Self,
    Option<i32>,
    &mut B,
    &mut VarMap<V>
) -> i32 where
    B: Backend
[src]

Encode that repr is true if the constraint is satisfied. The implementation can decide if it has the semantics of encode_constraint_implies_repr or encode_constraint_equals_repr, depending on what is cheaper to encode. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V> SatVar for V where
    V: Hash + Eq + Clone + Debug
[src]