GenericSolveHandle

Struct GenericSolveHandle 

Source
pub struct GenericSolveHandle<C: ControlCtx, E: SolveEventHandler> { /* private fields */ }
Expand description

Search handle to a solve call.

Implementations§

Source§

impl<C: ControlCtx, E: SolveEventHandler> GenericSolveHandle<C, E>

Source

pub fn get(&mut self) -> Result<SolveResult, ClingoError>

Get the next solve result.

Blocks until the result is ready. When yielding partial solve results can be obtained, i.e., when a model is ready, the result will be satisfiable but neither the search exhausted nor the optimality proven.

§Errors
Source

pub fn wait(&mut self, timeout: Duration) -> bool

Wait for the specified amount of time to check if the next result is ready.

If the time is set to zero, this function can be used to poll if the search is still active. If the time is negative, the function blocks until the search is finished.

§Arguments
  • timeout - the maximum time to wait
Source

pub fn model(&mut self) -> Result<Option<&Model>, ClingoError>

Get the next model or None if there are no more models.

§Errors
Source

pub fn model_mut(&mut self) -> Result<Option<&mut Model>, ClingoError>

Get the next model or None if there are no more models.

§Errors
Source

pub fn core(&mut self) -> Result<Vec<SolverLiteral>, ClingoError>

When a problem is unsatisfiable, get a subset of the assumptions that made the problem unsatisfiable.

If the program is not unsatisfiable, an empty vector is returned.

Returns the unsatisfiable core

§Errors
Source

pub fn resume(&mut self) -> Result<(), ClingoError>

Discards the last model and starts the search for the next one.

If the search has been started asynchronously, this function continues the search in the background.

Note: This function does not block.

§Errors
Source

pub fn cancel(&mut self) -> Result<(), ClingoError>

Stop the running search and block until done.

§Errors
Source

pub fn close(self) -> Result<GenericControl<C>, ClingoError>

Stops the running search and releases the handle.

Blocks until the search is stopped (as if an implicit cancel was called before the handle is released).

§Errors

Trait Implementations§

Source§

impl<C: Debug + ControlCtx, E: Debug + SolveEventHandler> Debug for GenericSolveHandle<C, E>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<C, E> Freeze for GenericSolveHandle<C, E>

§

impl<C, E> RefUnwindSafe for GenericSolveHandle<C, E>

§

impl<C, E> !Send for GenericSolveHandle<C, E>

§

impl<C, E> !Sync for GenericSolveHandle<C, E>

§

impl<C, E> Unpin for GenericSolveHandle<C, E>

§

impl<C, E> UnwindSafe for GenericSolveHandle<C, E>
where E: UnwindSafe, C: UnwindSafe,

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> 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, 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.