[−][src]Struct varisat::Var
A boolean variable.
A boolean value is represented by an index. Internally these are 0-based, i.e. the first variable has the index 0. For user IO a 1-based index is used, to allow denoting negated variables using negative integers. This convention is also used in the DIMACS CNF format.
Creating a variable with an index larger than Var::max_var().index() is unsupported. This
might panic or be interpreted as a different variable.
Fields
index: u32Methods
impl Var[src]
pub fn from_dimacs(number: isize) -> Var[src]
Creates a variable from a 1-based index as used in the DIMCAS CNF encoding.
The parameter must be positive and may not represent a variable past Var::max_var().
pub fn from_index(index: usize) -> Var[src]
Creates a variable from a 0-based index.
The index may not represent a variable past Var::max_var().
pub fn to_dimacs(self) -> isize[src]
The 1-based index representing this variable in the DIMACS CNF encoding.
pub const fn index(self) -> usize[src]
The 0-based index representing this variable.
pub const fn max_var() -> Var[src]
The variable with largest index that is supported.
This is less than the backing integer type supports. This enables storing a variable index
and additional bits (as in Lit) or sentinel values in a single word.
pub const fn max_count() -> usize[src]
Largest number of variables supported.
This is exactly Var::max_var().index() + 1.
pub fn lit(self, polarity: bool) -> Lit[src]
Creates a literal from this var and a bool that is true when the literal is positive.
Shortcut for Lit::from_var(var, polarity).
pub fn positive(self) -> Lit[src]
Creates a positive literal from this var.
Shortcut for Lit::positive(var).
pub fn negative(self) -> Lit[src]
Creates a negative literal from this var.
Shortcut for Lit::negative(var).
Trait Implementations
impl Copy for Var[src]
impl Ord for Var[src]
fn cmp(&self, other: &Var) -> Ordering[src]
fn max(self, other: Self) -> Self1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self1.21.0[src]
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self[src]
clamp)Restrict a value to a certain interval. Read more
impl Clone for Var[src]
fn clone(&self) -> Var[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Debug for Var[src]
Uses the 1-based DIMACS CNF encoding.
impl PartialEq<Var> for Var[src]
impl From<Var> for Lit[src]
impl PartialOrd<Var> for Var[src]
fn partial_cmp(&self, other: &Var) -> Option<Ordering>[src]
fn lt(&self, other: &Var) -> bool[src]
fn le(&self, other: &Var) -> bool[src]
fn gt(&self, other: &Var) -> bool[src]
fn ge(&self, other: &Var) -> bool[src]
impl Hash for Var[src]
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher, [src]
__H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher]. Read more
impl Eq for Var[src]
fn assert_receiver_is_total_eq(&self)[src]
impl Display for Var[src]
Uses the 1-based DIMACS CNF encoding.
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T> From<T> for T[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<Reference, Outer, OuterFieldType, Inner> HasPart<Nested<Outer, Inner>> for Reference where
Inner: Part,
Outer: Part<PartType = Field<OuterFieldType>>,
OuterFieldType: HasPart<Inner, RawTarget = OuterFieldType> + PartialRefTarget + ?Sized,
Reference: HasPart<Outer> + ?Sized,
Inner: Part,
Outer: Part<PartType = Field<OuterFieldType>>,
OuterFieldType: HasPart<Inner, RawTarget = OuterFieldType> + PartialRefTarget + ?Sized,
Reference: HasPart<Outer> + ?Sized,
unsafe fn part_ptr(
ptr: *const <Reference as PartialRefTarget>::RawTarget
) -> <<Inner as Part>::PartType as PartType>::Ptr
ptr: *const <Reference as PartialRefTarget>::RawTarget
) -> <<Inner as Part>::PartType as PartType>::Ptr
unsafe fn part_ptr_mut(
ptr: *mut <Reference as PartialRefTarget>::RawTarget
) -> <<Inner as Part>::PartType as PartType>::PtrMut
ptr: *mut <Reference as PartialRefTarget>::RawTarget
) -> <<Inner as Part>::PartType as PartType>::PtrMut