Trait swipl::dict::IntoKey

source ·
pub trait IntoKey {
    // Required method
    fn atom_ptr(self) -> (atom_t, Option<Atom>);
}
Expand description

Trait for things that can behave as a key for the purpose of retrieving values from a prolog dictionary.

A prolog dictionary key can either be an atom or an integer. In addition, various things can be automatically converted to atoms. This trait provides an implementation which facilitates this.

Required Methods§

source

fn atom_ptr(self) -> (atom_t, Option<Atom>)

Returns the atom_t corresponding to this key, plus an allocation.

As long as the allocation remains in scope, the atom_t can be considered safe to use in unsafe code.

This is used by dict querying code to efficiently get hold of dictionary keys (which internally are always atom_t).

Implementations on Foreign Types§

source§

impl IntoKey for u64

source§

impl<'a, A: AsAtom + ?Sized> IntoKey for &'a A

Implementors§