VecAssignment

Struct VecAssignment 

Source
pub struct VecAssignment { /* private fields */ }
Expand description

An implementation of Assignment using a Vec<VarState>.

This implementation is efficient for dense sets of variables, where variable IDs are contiguous and start from 0 (i.e. 0, 1, ..., n-1). Indexing with a usize value greater than or equal to the number of variables will result in a panic.

Trait Implementations§

Source§

impl Assignment for VecAssignment

Source§

fn new(n_vars: usize) -> Self

Creates a new VecAssignment for n_vars variables. Variables are indexed from 0 to n_vars - 1.

Source§

fn num_vars(&self) -> usize

Returns the total number of variables this assignment manager is configured for.
Source§

fn set(&mut self, var: Variable, b: bool)

Sets the truth value of a variable. Read more
Source§

fn reset(&mut self)

Resets all variables to the Unassigned state.
Source§

fn unassign(&mut self, var: Variable)

Sets a variable to the Unassigned state. Read more
Source§

fn get_solutions(&self) -> Solutions

Retrieves the current set of assigned variables as a Solutions object. Read more
Source§

fn all_assigned(&self) -> bool

Checks if all variables managed by this assignment are currently assigned. Read more
Source§

fn assign(&mut self, l: impl Literal)

Assigns a truth value to a variable based on a literal. Read more
Source§

fn is_assigned(&self, var: Variable) -> bool

Checks if a specific variable is assigned a truth value. Read more
Source§

fn var_value(&self, var: Variable) -> Option<bool>

Gets the truth value of a variable, if assigned. Read more
Source§

fn literal_value(&self, l: impl Literal) -> Option<bool>

Gets the truth value of a literal under the current assignment. Read more
Source§

fn unassigned(&self) -> impl Iterator<Item = Variable> + '_

Returns an iterator over all currently unassigned variables. Read more
Source§

impl Clone for VecAssignment

Source§

fn clone(&self) -> VecAssignment

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VecAssignment

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for VecAssignment

Source§

fn default() -> VecAssignment

Returns the “default value” for a type. Read more
Source§

impl Index<usize> for VecAssignment

Source§

fn index(&self, index: usize) -> &Self::Output

Accesses the state of the variable at the given index.

§Panics

Panics if index is out of bounds. The unsafe get_unchecked is used for performance, assuming valid indices from internal logic.

Source§

type Output = VarState

The returned type after indexing.
Source§

impl IndexMut<usize> for VecAssignment

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Mutably accesses the state of the variable at the given index.

§Panics

Panics if index is out of bounds. The unsafe get_unchecked_mut is used for performance, similar to index.

Source§

impl PartialEq for VecAssignment

Source§

fn eq(&self, other: &VecAssignment) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for VecAssignment

Source§

impl StructuralPartialEq for VecAssignment

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.