Struct swipl::atom::Atom

source ·
pub struct Atom { /* private fields */ }
Expand description

A wrapper for a prolog atom.

When created, the underlying atom will have its reference count increased. When dropped, the reference count will decrease.

Implementations§

source§

impl Atom

source

pub unsafe fn wrap(atom: atom_t) -> Atom

Wrap an atom_t, which is how the SWI-Prolog fli represents atoms.

Safety

This is unsafe because no check is done to ensure that the atom_t indeed points at a valid atom. The caller will have to ensure that this is the case.

source

pub fn new(name: &str) -> Atom

Create a new atom from the given string.

This will panic if no prolog engine is active on this thread.

If the atom already exists, this will raise the reference count on that atom and then return the existing atom.

source

pub fn atom_ptr(&self) -> atom_t

Return the underlying atom_t which SWI-Prolog uses to refer to the atom.

source

pub fn name(&self) -> String

Retrieve the name of this atom, that is, the string with which it was created.

This will panic if no prolog engine is active on this thread.

Trait Implementations§

source§

impl AsAtom for &Atom

source§

fn as_atom(&self) -> Atom

Turn the borrowed object into an Atom. Read more
source§

fn as_atom_ptr(&self) -> (atom_t, Option<Atom>)

Turn the borrowed object into an atom_t, and returns an allocation which will keep this atom_t valid as long as it is not dropped. Read more
source§

impl AsAtom for Atom

source§

fn as_atom(&self) -> Atom

Turn the borrowed object into an Atom. Read more
source§

fn as_atom_ptr(&self) -> (atom_t, Option<Atom>)

Turn the borrowed object into an atom_t, and returns an allocation which will keep this atom_t valid as long as it is not dropped. Read more
source§

impl Clone for Atom

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Atom

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Atom

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Drop for Atom

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl From<Atom> for String

source§

fn from(atom: Atom) -> String

Converts to this type from the input type.
source§

impl Hash for Atom

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl IntoAtom for &Atom

source§

fn into_atom(self) -> Atom

Turn this object into an Atom.
source§

impl IntoAtom for Atom

source§

fn into_atom(self) -> Atom

Turn this object into an Atom.
source§

impl PartialEq for Atom

source§

fn eq(&self, other: &Atom) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Atom

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<'a> TermGetable for Atom

source§

fn get(term: &Term<'_>) -> Option<Self>

Get data from a term reference. Read more
source§

fn name() -> &'static str

Get the name of this data type for use in exception reporting.
source§

impl<'a> TermPutable for Atom

source§

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

Put data into the term reference. Read more
source§

impl ToString for Atom

source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<'a> Unifiable for Atom

source§

fn unify(&self, term: &Term<'_>) -> bool

Unify this data with the given term reference. Read more
source§

impl Eq for Atom

source§

impl StructuralEq for Atom

source§

impl StructuralPartialEq for Atom

Auto Trait Implementations§

§

impl RefUnwindSafe for Atom

§

impl Send for Atom

§

impl Sync for Atom

§

impl Unpin for Atom

§

impl UnwindSafe for Atom

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,