Trait swipl::term::TermPutable

source ·
pub unsafe trait TermPutable {
    // Required method
    fn put(&self, term: &Term<'_>);
}
Expand description

Trait for putting data into a term reference.

Unlike unification, putting data into a term replaces the term entirely. This is a non-logical operation that doesn’t play nice with backtracking. You’re generally better off using unification.

Safety

This is marked unsafe because in order to do term putting, we must be sure that

  • the term is created on the engine which is currently active
  • the given context is a context for this engine

Not checking those preconditions results in undefined behavior. Therefore, care must be taken to ensure that put is actually safe.

The macro [term_putable!] provides a way to safely implement this trait by doing the precondition checks for you.

Required Methods§

source

fn put(&self, term: &Term<'_>)

Put data into the term reference.

You’d generally not use this directly, but rather, go through Term::put.

Implementations on Foreign Types§

source§

impl<'a> TermPutable for bool

source§

fn put(&self, term: &Term<'_>)

source§

impl<'a> TermPutable for f64

source§

fn put(&self, term: &Term<'_>)

source§

impl<'a> TermPutable for i64

source§

fn put(&self, term: &Term<'_>)

source§

impl<'a> TermPutable for str

source§

fn put(&self, term: &Term<'_>)

source§

impl<'a> TermPutable for u64

source§

fn put(&self, term: &Term<'_>)

source§

impl<'a> TermPutable for String

source§

fn put(&self, term: &Term<'_>)

source§

impl<'a> TermPutable for [u8]

source§

fn put(&self, term: &Term<'_>)

source§

impl<T: ArcBlob> TermPutable for Arc<T>

source§

fn put(&self, term: &Term<'_>)

Implementors§