[−][src]Struct varisat::clause::alloc::ClauseAlloc
Bump allocator for clause storage.
Clauses are allocated from a single continuous buffer. Clauses cannot be freed individually. To
reclaim space from deleted clauses, a new ClauseAlloc
is created and the remaining clauses are
copied over.
When the ClauseAlloc
's buffer is full, it is reallocated using the growing strategy of
Vec
. External references (ClauseRef
) store an offset into the ClauseAlloc
's memory and
remaind valid when the buffer is grown. Clauses are aligned and the offset represents a multiple
of the alignment size. This allows using 32-bit offsets while still supporting up to 16GB of
clauses.
Fields
buffer: Vec<LitIdx>
Methods
impl ClauseAlloc
[src]
pub fn new() -> ClauseAlloc
[src]
Create an emtpy clause allocator.
pub fn with_capacity(capacity: usize) -> ClauseAlloc
[src]
Create a clause allocator with preallocated capacity.
pub fn add_clause(&mut self, header: ClauseHeader, lits: &[Lit]) -> ClauseRef
[src]
Allocate space for and add a new clause.
Clauses have a minimal size of 3, as binary and unit clauses are handled separately. This is enforced on the ClauseAlloc level to safely avoid extra bound checks when accessing the initial literals of a clause.
The size of the header will be set to the size of the given slice. The returned
ClauseRef
can be used to access the new clause.
pub fn header(&self, cref: ClauseRef) -> &ClauseHeader
[src]
Access the header of a clause.
pub fn header_mut(&mut self, cref: ClauseRef) -> &mut ClauseHeader
[src]
Mutate the header of a clause.
unsafe fn header_unchecked(&self, cref: ClauseRef) -> &ClauseHeader
[src]
pub unsafe fn header_unchecked_mut(
&mut self,
cref: ClauseRef
) -> &mut ClauseHeader
[src]
&mut self,
cref: ClauseRef
) -> &mut ClauseHeader
Mutate the header of a clause without bound checks.
pub fn clause(&self, cref: ClauseRef) -> &Clause
[src]
Access a clause.
pub fn clause_mut(&mut self, cref: ClauseRef) -> &mut Clause
[src]
Mutate a clause.
pub unsafe fn lits_ptr_mut_unchecked(&mut self, cref: ClauseRef) -> *mut Lit
[src]
Mutate the literals of a clause without bound checks.
pub fn check_bounds(&self, cref: ClauseRef, len: usize)
[src]
Perform a manual bound check on a ClauseRef assuming a given clause length.
unsafe fn clause_with_len_unchecked(
&self,
cref: ClauseRef,
len: usize
) -> &Clause
[src]
&self,
cref: ClauseRef,
len: usize
) -> &Clause
unsafe fn clause_with_len_unchecked_mut(
&mut self,
cref: ClauseRef,
len: usize
) -> &mut Clause
[src]
&mut self,
cref: ClauseRef,
len: usize
) -> &mut Clause
pub fn buffer_size(&self) -> usize
[src]
Current buffer size in multiples of LitIdx
.
Trait Implementations
impl Default for ClauseAlloc
[src]
fn default() -> ClauseAlloc
[src]
Auto Trait Implementations
impl Send for ClauseAlloc
impl Sync for ClauseAlloc
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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