pub struct Configuration(/* private fields */);Expand description
Handle for the solver configuration.
Implementations§
Source§impl Configuration
impl Configuration
Sourcepub fn root(&self) -> Result<Id, ClingoError>
pub fn root(&self) -> Result<Id, ClingoError>
Get the root key of the configuration.
Sourcepub fn configuration_type(
&self,
Id: Id,
) -> Result<ConfigurationType, ClingoError>
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.
Sourcepub fn description(&self, Id: Id) -> Result<&str, ClingoError>
pub fn description(&self, Id: Id) -> Result<&str, ClingoError>
Sourcepub fn array_size(&self, Id: Id) -> Result<usize, ClingoError>
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.
Sourcepub fn array_at(&self, Id: Id, offset: usize) -> Result<Id, ClingoError>
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 keyoffset- the offset in the array
Sourcepub fn map_size(&self, Id: Id) -> Result<usize, ClingoError>
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.
Sourcepub fn map_has_subkey(&self, Id: Id, name: &str) -> Result<bool, ClingoError>
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 keyname- the name to lookup the subkey
§Errors
ClingoError::InternalErrorClingoError::NulError- ifnamecontains a nul byte
Returns whether the key is in the map
Sourcepub fn map_subkey_name(
&self,
Id: Id,
offset: usize,
) -> Result<&str, ClingoError>
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 keyoffset- the offset of the name
§Errors
Sourcepub fn map_at(&self, Id: Id, name: &str) -> Result<Id, ClingoError>
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
ClingoError::InternalErrorClingoError::NulError- ifnamecontains a nul byte
Note: Multiple levels can be looked up by concatenating keys with a period.
Sourcepub fn value_is_assigned(&self, Id: Id) -> Result<bool, ClingoError>
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
Sourcepub fn value_get(&self, Id: Id) -> Result<String, ClingoError>
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
Sourcepub fn value_set(&mut self, Id: Id, value: &str) -> Result<(), ClingoError>
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 keyvalue- the value to set
§Errors
ClingoError::NulError- ifvaluecontains a nul byteClingoError::InternalError