Configuration

Struct Configuration 

Source
pub struct Configuration(/* private fields */);
Expand description

Handle for the solver configuration.

Implementations§

Source§

impl Configuration

Source

pub fn root(&self) -> Result<Id, ClingoError>

Get the root key of the configuration.

Source

pub fn configuration_type( &self, Id: Id, ) -> Result<ConfigurationType, ClingoError>

Get the type of a key. The type is a bitset, an entry can have multiple (but at least one) type.

Source

pub fn description(&self, Id: Id) -> Result<&str, ClingoError>

Get the description of an entry.

§Errors
Source

pub fn array_size(&self, Id: Id) -> Result<usize, ClingoError>

Get the size of an array entry.

§Pre-condition

The Configuration::configuration_type() of the entry must be ConfigurationType::ARRAY.

Source

pub fn array_at(&self, Id: Id, offset: usize) -> Result<Id, ClingoError>

Get the subkey at the given offset of an array entry.

Note: Some array entries, like fore example the solver configuration, can be accessed past there actual size to add subentries.

§Pre-condition

The Configuration::configuration_type() of the entry must be ConfigurationType::ARRAY.

§Arguments
  • key - the key
  • offset - the offset in the array
Source

pub fn map_size(&self, Id: Id) -> Result<usize, ClingoError>

Get the number of subkeys of a map entry.

§Pre-condition

The Configuration::configuration_type() of the entry must be ConfigurationType::MAP.

Source

pub fn map_has_subkey(&self, Id: Id, name: &str) -> Result<bool, ClingoError>

Query whether the map has a key.

§Pre-condition

The Configuration::configuration_type() of the entry must be ConfigurationType::MAP.

Note: Multiple levels can be looked up by concatenating keys with a period.

§Arguments
  • key - the key
  • name - the name to lookup the subkey
§Errors

Returns whether the key is in the map

Source

pub fn map_subkey_name( &self, Id: Id, offset: usize, ) -> Result<&str, ClingoError>

Get the name associated with the offset-th subkey.

§Pre-condition

The Configuration::configuration_type() of the entry must be ConfigurationType::MAP.

§Arguments
  • key - the key
  • offset - the offset of the name
§Errors
Source

pub fn map_at(&self, Id: Id, name: &str) -> Result<Id, ClingoError>

Lookup a subkey under the given name.

§Pre-condition

The Configuration::configuration_type() of the entry must be ConfigurationType::MAP.

§Errors

Note: Multiple levels can be looked up by concatenating keys with a period.

Source

pub fn value_is_assigned(&self, Id: Id) -> Result<bool, ClingoError>

Check whether a entry has a value.

§Pre-condition

The Configuration::configuration_type() of the entry must be ConfigurationType::VALUE.

§Arguments
  • key - the key
Source

pub fn value_get(&self, Id: Id) -> Result<String, ClingoError>

Get the string value of the given entry.

§Pre-condition

The Configuration::configuration_type() of the entry must be ConfigurationType::VALUE.

§Arguments
  • key - the key
§Errors
Source

pub fn value_set(&mut self, Id: Id, value: &str) -> Result<(), ClingoError>

Set the value of an entry.

§Pre-condition

The Configuration::configuration_type() of the entry must be ConfigurationType::VALUE.

§Arguments
  • key - the key
  • value - the value to set
§Errors

Trait Implementations§

Source§

impl Debug for Configuration

Source§

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

Formats the value using the given formatter. Read more

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