Enum swipl::atom::Atomable

source ·
pub enum Atomable<'a> {
    Str(&'a str),
    String(String),
}
Expand description

A type that allows easy conversion of strings from and to an atom.

Variants§

§

Str(&'a str)

§

String(String)

Implementations§

source§

impl<'a> Atomable<'a>

source

pub fn new<T: Into<Atomable<'a>>>(s: T) -> Self

Create a new Atomable out of a String or an &str.

source

pub fn name(&self) -> &str

Return the name.

source

pub fn owned(&self) -> Atomable<'static>

Convert this Atomable into a new Atomable which is guaranteed to own its data.

Trait Implementations§

source§

impl<'a> AsAtom for Atomable<'a>

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<'a> AsRef<str> for Atomable<'a>

source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<'a> From<&'a str> for Atomable<'a>

source§

fn from(s: &str) -> Atomable<'_>

Converts to this type from the input type.
source§

impl<'a> From<String> for Atomable<'a>

source§

fn from(s: String) -> Atomable<'static>

Converts to this type from the input type.
source§

impl<'a> IntoAtom for &Atomable<'a>

source§

fn into_atom(self) -> Atom

Turn this object into an Atom.
source§

impl<'a> IntoAtom for Atomable<'a>

source§

fn into_atom(self) -> Atom

Turn this object into an Atom.
source§

impl<'a> TermGetable for Atomable<'static>

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 Atomable<'a>

source§

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

Put data into the term reference. Read more
source§

impl<'a> Unifiable for Atomable<'a>

source§

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

Unify this data with the given term reference. Read more

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Atomable<'a>

§

impl<'a> Send for Atomable<'a>

§

impl<'a> Sync for Atomable<'a>

§

impl<'a> Unpin for Atomable<'a>

§

impl<'a> UnwindSafe for Atomable<'a>

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, 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.