pub struct Assignment { /* private fields */ }
Expand description
An assignment comprising a mapping plus a trail (vector of literals).
Note that Literal::TOP
is always assigned.
It is valid to assign both a literal and its negation - this is how we detect a conflict.
Implementations§
Source§impl Assignment
impl Assignment
Sourcepub fn new(maxvar: Variable) -> Assignment
pub fn new(maxvar: Variable) -> Assignment
Create an empty assignment.
Sourcepub fn position_in_trail(&self, literal: Literal) -> usize
pub fn position_in_trail(&self, literal: Literal) -> usize
Return the position in the trail where this literal was assigned.
Sourcepub fn push(&mut self, lit: Literal, reason: Reason)
pub fn push(&mut self, lit: Literal, reason: Reason)
Add a new literal to the trail, assigning it to true.
Sourcepub fn pop(&mut self) -> Option<(Literal, Reason)>
pub fn pop(&mut self) -> Option<(Literal, Reason)>
Unassign the literal that was assigned last.
Sourcepub fn move_to(&mut self, src: usize, dst: usize)
pub fn move_to(&mut self, src: usize, dst: usize)
Move the literal at trail position src
to dst
.
Sourcepub fn resize(&mut self, level: usize)
pub fn resize(&mut self, level: usize)
Change the size of the trail. Note: this does not change the assigned values, only the trail.
Sourcepub fn unassign(&mut self, literal: Literal)
pub fn unassign(&mut self, literal: Literal)
Remove the assignment for a literal, without modifying the trail.
Sourcepub fn set_trail_at(&mut self, offset: usize, literal: Literal, reason: Reason)
pub fn set_trail_at(&mut self, offset: usize, literal: Literal, reason: Reason)
Insert a literal into the trail and assign it.
pub fn iter(&self) -> Iter<'_, (Literal, Reason)>
Trait Implementations§
Source§impl Clone for Assignment
impl Clone for Assignment
Source§fn clone(&self) -> Assignment
fn clone(&self) -> Assignment
Returns a copy 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 Assignment
impl Debug for Assignment
Source§impl Display for Assignment
impl Display for Assignment
Source§impl HeapSpace for Assignment
impl HeapSpace for Assignment
Source§fn heap_space(&self) -> usize
fn heap_space(&self) -> usize
The number of bytes allocated on the heap that this owns.
Source§impl Index<Literal> for Assignment
impl Index<Literal> for Assignment
Source§impl<'a> IntoIterator for &'a Assignment
Iterate over the literals in the trail, from oldest to newest.
impl<'a> IntoIterator for &'a Assignment
Iterate over the literals in the trail, from oldest to newest.
Source§impl PartialEq for Assignment
impl PartialEq for Assignment
Auto Trait Implementations§
impl Freeze for Assignment
impl RefUnwindSafe for Assignment
impl Send for Assignment
impl Sync for Assignment
impl Unpin for Assignment
impl UnwindSafe for Assignment
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