Statistics

Struct Statistics 

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

Handle for to the solver statistics.

Implementations§

Source§

impl Statistics

Source

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

Get the root key of the statistics.

Source

pub fn statistics_type(&self, key: u64) -> Result<StatisticsType, ClingoError>

Get the type of a key.

§Arguments
  • key - the key
Source

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
Source

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 key
  • offset - the offset in the array
Source

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 key
  • stype - the type of the new subkey
Source

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
Source

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 key
  • name - name of the subkey
§Errors
Source

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 key
  • offset - the offset of the name
§Errors
Source

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 key
  • name - the name to lookup the subkey
§Errors
Source

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 key
  • name - the name to lookup the subkey
  • stype - the type of the new subkey
§Errors

Returns the index of the resulting subkey

Source

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
Source

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 key
  • value - the new value

Returns whether the call was successful

Trait Implementations§

Source§

impl Debug for Statistics

Source§

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

Formats the value using the given formatter. Read more
Source§

impl From<&mut Statistics> for *mut clingo_statistic

Source§

fn from(stats: &mut Statistics) -> Self

Converts to this type from the input type.
Source§

impl From<Statistics> for clingo_statistic

Source§

fn from(stats: Statistics) -> Self

Converts to this type from the input type.

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.