pub struct Statistics(/* private fields */);Expand description
Handle for to the solver statistics.
Implementations§
Source§impl Statistics
impl Statistics
Sourcepub fn root(&self) -> Result<u64, ClingoError>
pub fn root(&self) -> Result<u64, ClingoError>
Get the root key of the statistics.
Sourcepub fn statistics_type(&self, key: u64) -> Result<StatisticsType, ClingoError>
pub fn statistics_type(&self, key: u64) -> Result<StatisticsType, ClingoError>
Sourcepub fn array_size(&self, key: u64) -> Result<usize, ClingoError>
pub fn array_size(&self, key: u64) -> Result<usize, ClingoError>
Get the size of an array entry.
§Pre-condition
The Statistics::statistics_type() of the entry must be
StatisticsType::Array.
§Arguments
key- the key
Sourcepub fn array_at(&self, key: u64, offset: usize) -> Result<u64, ClingoError>
pub fn array_at(&self, key: u64, offset: usize) -> Result<u64, ClingoError>
Get the subkey at the given offset of an array entry.
§Pre-condition
The Statistics::statistics_type() of the entry must be
StatisticsType::Array.
§Arguments
key- the keyoffset- the offset in the array
Sourcepub fn array_push(
&mut self,
key: u64,
stype: StatisticsType,
) -> Result<u64, ClingoError>
pub fn array_push( &mut self, key: u64, stype: StatisticsType, ) -> Result<u64, ClingoError>
Create the subkey at the end of an array entry.
#Pre-condition
The Statistics::statistics_type() of the entry must
be StatisticsType::Array
§Arguments
key- the keystype- the type of the new subkey
Sourcepub fn map_size(&self, key: u64) -> Result<usize, ClingoError>
pub fn map_size(&self, key: u64) -> Result<usize, ClingoError>
Get the number of subkeys of a map entry.
§Pre-condition
The Statistics::statistics_type() of the entry must
be StatisticsType::Map.
§Arguments
key- the key
Sourcepub fn map_has_subkey(&self, key: u64, name: &str) -> Result<bool, ClingoError>
pub fn map_has_subkey(&self, key: u64, name: &str) -> Result<bool, ClingoError>
Test if the given map contains a specific subkey.
§Pre-condition
The Statistics::statistics_type() of the entry must
be StatisticsType::Map.
§Arguments
key- the keyname- name of the subkey
§Errors
ClingoError::InternalErrorClingoError::NulError- ifnamecontains a nul byte
Sourcepub fn map_subkey_name(
&self,
key: u64,
offset: usize,
) -> Result<&str, ClingoError>
pub fn map_subkey_name( &self, key: u64, offset: usize, ) -> Result<&str, ClingoError>
Get the name associated with the offset-th subkey.
§Pre-condition
The Statistics::statistics_type() of the entry must be
StatisticsType::Map.
§Arguments
key- the keyoffset- the offset of the name
§Errors
Sourcepub fn map_at(&self, key: u64, name: &str) -> Result<u64, ClingoError>
pub fn map_at(&self, key: u64, name: &str) -> Result<u64, ClingoError>
Lookup a subkey under the given name.
§Pre-condition
The Statistics::statistics_type() of the entry must be
StatisticsType::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
Sourcepub fn map_add_subkey(
&mut self,
key: u64,
name: &str,
stype: StatisticsType,
) -> Result<u64, ClingoError>
pub fn map_add_subkey( &mut self, key: u64, name: &str, stype: StatisticsType, ) -> Result<u64, ClingoError>
Add a subkey with the given name.
§Pre-condition
The Statistics::statistics_type() of the entry must be
StatisticsType::Map.
§Arguments
key- the keyname- the name to lookup the subkeystype- the type of the new subkey
§Errors
ClingoError::InternalErrorClingoError::NulError- ifnamecontains a nul byte
Returns the index of the resulting subkey
Sourcepub fn value_get(&self, key: u64) -> Result<f64, ClingoError>
pub fn value_get(&self, key: u64) -> Result<f64, ClingoError>
Get the value of the given entry.
§Pre-condition
The Statistics::statistics_type() of the entry must be
StatisticsType::Value.
§Arguments
key- the key
Sourcepub fn value_set(&mut self, key: u64, value: f64) -> bool
pub fn value_set(&mut self, key: u64, value: f64) -> bool
Set the value of the given entry.
§Pre-condition
The Statistics::statistics_type() of the entry must be
StatisticsType::Value.
§Arguments
key- the keyvalue- the new value
Returns whether the call was successful