[−][src]Crate clingo
This crate provides bindings to the clingo library version 5.3.0.
clingo_derive
crate
The clingo_derive
crate helps easing the use of rust data types as facts.
In your Cargo.toml
add:
[dependencies]
clingo-rs = "0.4.3"
clingo-derive = "*"
In your source write:
use clingo_derive::*; use clingo::FactBase; #[derive(ToSymbol)] struct Point { x: i32, y: i32, } let p = Point{ x:4, y:2 }; let fb = FactBase::new(); fb.insert(p);
--dynamic_linking
The clingo
crate defines a Cargo feature that allows to use the clingo library via dynamic linking.
With dynamic linking enabled the clingo library is not build for static linking but it is assumed that a shared clingo library is installed on the system.
The recommended way to use the optional dynamic linking support is as follows.
[dependencies]
clingo = { version = "0.4.3", features = ["dynamic_linking"] }
Modules
ast | Functions and data structures to work with program ASTs. |
Structs
AllModels | |
Assignment | Represents a (partial) assignment of a particular solver. |
AstStatement | Representation of a program statement. |
Atom | Unsigned integer type used for aspif atoms. |
Backend | Handle to the backend to add directives in aspif format. |
ClingoError | Error in the rust wrapper, like null pointers or failed matches of C enums. |
Configuration | Handle for the solver configuration. |
ConfigurationType | Bit flags describing the entries of a configuration. |
Control | Control object holding grounding and solving state. |
FactBase | |
Id | Unsigned integer type used in various places. |
Literal | Signed integer type used for aspif and solver literals. |
Location | Represents a source code location marking its beginning and end. |
LogicError | Wrong usage of the clingo API |
MModel | |
Model | Represents a model. |
OptimalModels | |
Part | Struct used to specify the program parts that have to be grounded. |
ProgramBuilder | Object to build non-ground programs. |
PropagateControl | This object can be used to add clauses and propagate literals while solving. |
PropagateInit | Object to initialize a user-defined propagator before each solving step. |
ShowType | Bit flags to select symbols in models. |
Signature | Represents a predicate signature. |
SolveControl | Object to add clauses during search. |
SolveHandle | Search handle to a solve call. |
SolveMode | Bit flags describing solve modes. |
SolveResult | Bit flags that describes the result of a solve call. |
Statistics | Handle for to the solver statistics. |
Symbol | Represents a symbol. |
SymbolicAtom | A symbolic atom in a program. |
SymbolicAtoms | Container that stores symbolic atoms in a program -- the relevant Herbrand base gringo uses to instantiate programs. |
SymbolicAtomsIterator | An iterator over symbolic atoms. |
TheoryAtoms | Container that stores theory atoms, elements, and terms of a program. |
TheoryAtomsIterator | Iterator over theory atoms. |
WeightedLiteral | A Literal with an associated weight. |
Enums
ClauseType | Enumeration of clause types determining the lifetime of a clause. |
ErrorCode | Enumeration of clingo error codes for |
ErrorType | Enumeration of clingo error types See: set_error() |
ExternalType | Enumeration of different external statements. |
HeuristicType | Enumeration of different heuristic modifiers. |
ModelType | Enumeration for the different model types. |
PropagatorCheckMode | Supported check modes for propagators. |
SolveEventType | Enumeration of solve events. |
StatisticsType | Enumeration for entries of the statistics. |
SymbolType | Enumeration of available symbol types. |
TheoryTermType | Enumeration of theory term types. |
TruthValue | Represents three-valued truth values. |
Warning | Enumeration of warning codes. |
Traits
AstStatementHandler | |
ExternalFunctionHandler | |
GroundProgramObserver | |
Logger | An instance of this trait has to be registered with a solver to implement a custom logging. |
Propagator | An instance of this trait has to be registered with a solver to implement a custom propagator. |
SolveEventHandler | |
ToSymbol | helper types and traits to simplify conversion from structs to clingo symbols |
Functions
add_facts | |
add_string | Internalize a string. |
parse_program | Parse the given program and return an abstract syntax tree for each statement via a callback. |
parse_program_with_logger | Parse the given program and return an abstract syntax tree for each statement via a callback. |
parse_term | Parse a term in string form. |
parse_term_with_logger | Parse a term in string form. |
set_error | Set an error code and message in the active thread. |
version | Obtain the clingo version. |