Expand description
Prolog terms.
In prolog, all data is a term. Terms are things like atoms or numbers, or compound structures like functors, lists, dictionaries, or tuples. Even prolog code itself is a term.
Interaction with SWI-Prolog terms happens through so-called term references. These term references live on the prolog stack, and they contain a term.
If we have a term reference, we can get data from it, and put data into it. Furthermore, we can unify terms with eachother, or we can unify a term with user data.
As term references live on a stack, they aren’t valid forever. They’re only valid as long as the frame in which they are created is still around.
swipl-rs has been written to make working with terms easy. First, through lifetimes, it is always ensured that you can only work with terms that are still in scope. As soon as a frame goes out of context, trying to use a term that was created by that frame will result in a compile error.
Second, getting data into and out of terms can all be done through
a unified interface on Term
. This interface is extendable with
your own types that you wish to get into or out of prolog.
Third, swipl-rs supports construction of complex terms through the term! macro. Consider using this macro when you have to produce deeply nested types.
Re-exports
pub use de::Deserializer;
pub use ser::Serializer;
pub use ser::SerializerConfiguration;
Modules
- Deserialization of rust values from prolog terms.
- Serialization of rust values into prolog terms.
Structs
- Unit struct representing an empty list in SWI-Prolog.
- A term reference.
Enums
- Various types a term can be.
Traits
- Trait for getting data from a term reference.
- Trait for putting data into a term reference.
- Trait for term unification.