Struct clingo::Symbol
[−]
[src]
pub struct Symbol(_);
Represents a symbol.
This includes numbers, strings, functions (including constants when arguments are empty and tuples when the name is empty), #inf and #sup.
Methods
impl Symbol
[src]
pub fn create_number(number: i32) -> Symbol
[src]
Construct a symbol representing a number.
pub fn create_supremum() -> Symbol
[src]
Construct a symbol representing #sup.
pub fn create_infimum() -> Symbol
[src]
Construct a symbol representing #inf
pub fn create_string(string: &str) -> Result<Symbol, Error>
[src]
Construct a symbol representing a string.
Arguments
string
- the string
Errors:
NulError
- ifstring
contains a nul byteErrorType::BadAlloc
pub fn create_id(name: &str, positive: bool) -> Result<Symbol, Error>
[src]
Construct a symbol representing an id.
Note: This is just a shortcut for create_function()
with
empty arguments.
Arguments
name
- the name of the symbolpositive
- whether the symbol has a classical negation sign
Errors
NulError
- ifname
contains a nul byteErrorType::BadAlloc
pub fn create_function(
name: &str,
arguments: &[Symbol],
positive: bool
) -> Result<Symbol, Error>
[src]
name: &str,
arguments: &[Symbol],
positive: bool
) -> Result<Symbol, Error>
Construct a symbol representing a function or tuple.
Note: To create tuples, the empty string has to be used as name.
Arguments
name
- the name of the functionarguments
- the arguments of the functionpositive
- whether the symbol has a classical negation sign
Errors
NulError
- ifname
contains a nul byteErrorType::BadAlloc
pub fn number(&self) -> Result<i32, ClingoError>
[src]
pub fn name(&self) -> Result<&str, Error>
[src]
Get the name of a symbol.
Errors
ErrorType::Runtime
if symbol is not of typeSymbolType::Function
Utf8Error
pub fn string(&self) -> Result<&str, Error>
[src]
Get the string of a symbol.
Errors
ErrorType::Runtime
if symbol is not of typeSymbolType::String
Utf8Error
pub fn is_positive(&self) -> Result<bool, ClingoError>
[src]
Check if a function is positive (does not have a sign).
Errors
ErrorType::Runtime
if symbol is not of typeSymbolType::Function
pub fn is_negative(&self) -> Result<bool, ClingoError>
[src]
Check if a function is negative (has a sign).
Errors
ErrorType::Runtime
if symbol is not of typeSymbolType::Function
pub fn arguments(&self) -> Result<Vec<Symbol>, ClingoError>
[src]
Get the arguments of a symbol.
Errors
ErrorType::Runtime
if symbol is not of typeSymbolType::Function
pub fn symbol_type(&self) -> SymbolType
[src]
pub fn to_string(&self) -> Result<String, Error>
[src]
Trait Implementations
impl Debug for Symbol
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Copy for Symbol
[src]
impl Clone for Symbol
[src]
fn clone(&self) -> Symbol
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq for Symbol
[src]
fn eq(&self, other: &Symbol) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Eq for Symbol
[src]
impl PartialOrd for Symbol
[src]
fn partial_cmp(&self, other: &Symbol) -> Option<Ordering>
[src]
Compare two symbols.
Symbols are first compared by type. If the types are equal, the values are compared (where strings are compared using strcmp). Functions are first compared by signature and then lexicographically by arguments.
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more