pub struct HashMapAssignment { /* private fields */ }Expand description
An implementation of Assignment using an FxHashMap<Variable, VarState>.
This implementation is suitable for sparse sets of variables or when variable IDs
are not necessarily small or contiguous. It stores states only for variables
that have been explicitly set or unassigned. Accessing a variable not in the map
via Index will return VarState::Unassigned.
Trait Implementations§
Source§impl Assignment for HashMapAssignment
impl Assignment for HashMapAssignment
Source§fn new(n_vars: usize) -> Self
fn new(n_vars: usize) -> Self
Creates a new HashMapAssignment.
§Arguments
n_vars: The conceptual number of variables. This is used byall_assignedto determine if all expected variables have assignments, and byunassignedto iterate up to this many variables.
Source§fn unassign(&mut self, var: Variable)
fn unassign(&mut self, var: Variable)
Unassigns a variable by setting its state to VarState::Unassigned in the map.
If the variable was not in the map, it will be inserted as Unassigned.
Source§fn num_vars(&self) -> usize
fn num_vars(&self) -> usize
Returns the total number of variables this assignment manager is configured for.
Source§fn get_solutions(&self) -> Solutions
fn get_solutions(&self) -> Solutions
Retrieves the current set of assigned variables as a
Solutions object. Read moreSource§fn all_assigned(&self) -> bool
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)
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
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>
fn var_value(&self, var: Variable) -> Option<bool>
Gets the truth value of a variable, if assigned. Read more
Source§impl Clone for HashMapAssignment
impl Clone for HashMapAssignment
Source§fn clone(&self) -> HashMapAssignment
fn clone(&self) -> HashMapAssignment
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HashMapAssignment
impl Debug for HashMapAssignment
Source§impl Default for HashMapAssignment
impl Default for HashMapAssignment
Source§fn default() -> HashMapAssignment
fn default() -> HashMapAssignment
Returns the “default value” for a type. Read more
Source§impl Index<usize> for HashMapAssignment
impl Index<usize> for HashMapAssignment
Source§impl IndexMut<usize> for HashMapAssignment
impl IndexMut<usize> for HashMapAssignment
Source§impl PartialEq for HashMapAssignment
impl PartialEq for HashMapAssignment
impl Eq for HashMapAssignment
impl StructuralPartialEq for HashMapAssignment
Auto Trait Implementations§
impl Freeze for HashMapAssignment
impl RefUnwindSafe for HashMapAssignment
impl Send for HashMapAssignment
impl Sync for HashMapAssignment
impl Unpin for HashMapAssignment
impl UnwindSafe for HashMapAssignment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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