[−][src]Struct varisat_formula::lit::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.
Implementations
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 Clone for Var
[src]
impl Copy for Var
[src]
impl Debug for Var
[src]
Uses the 1-based DIMACS CNF encoding.
impl Display for Var
[src]
Uses the 1-based DIMACS CNF encoding.
impl Eq for Var
[src]
impl From<Var> for Lit
[src]
impl Hash for Var
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Var
[src]
fn cmp(&self, other: &Var) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Var> for Var
[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 StructuralEq for Var
[src]
impl StructuralPartialEq for Var
[src]
Auto Trait Implementations
impl RefUnwindSafe for Var
impl Send for Var
impl Sync for Var
impl Unpin for Var
impl UnwindSafe for Var
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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>,