Macro swipl::term_putable
source · macro_rules! term_putable { (($self_:ident : $t:ty, $term_: ident) => $b: block) => { ... }; }
Expand description
Easily implement TermPutable.
Example:
struct Foo {num: u64}
term_putable!{
(self:Foo, term) => {
// body returns nothing, but underlying code may raise an exception on the prolog engine.
term.put(&self.num).unwrap_or(());
}
}
fn do_something(term: &Term) -> PrologResult<()> {
term.put(&Foo{num:42})?;
Ok(())
}