Struct swipl::module::Module

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

A wrapped fora prolog module.

Implementations§

source§

impl Module

source

pub unsafe fn wrap(module: module_t) -> Self

Wrap a module_t, which is how the SWI-Prolog fli represents modules.

Safety

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

source

pub fn new<A: IntoAtom>(name: A) -> Self

Create a new module from the given name.

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

source

pub fn module_ptr(&self) -> module_t

Return the underlying module_t which SWI-Prolog uses to refer to the module.

source

pub fn with_name<F, R>(&self, func: F) -> R
where F: Fn(&Atom) -> R,

Retrieve the name of this module as an atom and pass it into the given function.

The atom does not outlive this call, and the reference count is never incremented. This may be slightly faster in some cases than returning the name directly.

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

source

pub fn name(&self) -> Atom

Retrieve the name of this module as an atom.

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

source

pub fn name_string(&self) -> String

Retrieve the name of this module as a string.

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

Trait Implementations§

source§

impl Clone for Module

source§

fn clone(&self) -> Module

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 Module

source§

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

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

impl PartialEq for Module

source§

fn eq(&self, other: &Module) -> 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 Copy for Module

source§

impl Eq for Module

source§

impl Send for Module

source§

impl StructuralEq for Module

source§

impl StructuralPartialEq for Module

source§

impl Sync for Module

Auto Trait Implementations§

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.