Struct emf_core_base_rs::module::native_module::NativeModule[][src]

pub struct NativeModule<'a, O> { /* fields omitted */ }

A native module.

Implementations

impl<O> NativeModule<'_, O> where
    O: AccessIdentifier
[src]

pub const unsafe fn new(
    interface: NonNullConst<NativeModuleInterfaceFFI>
) -> Self
[src]

Construct a new instance from an interface.

Safety

This function allows the creation of invalid modules by bypassing lifetimes.

impl NativeModule<'_, Owned>[src]

pub const fn as_borrowed(&self) -> NativeModule<'_, BorrowImmutable<'_>>[src]

Borrows the module interface.

pub fn as_borrowed_mut(&mut self) -> NativeModule<'_, BorrowMutable<'_>>[src]

Borrows the module interface mutably.

impl<'a, O> NativeModule<'a, O> where
    O: MutableAccessIdentifier
[src]

pub unsafe fn load<MO>(
    &mut self,
    module: &Module<'_, MO>,
    interface: &impl CBaseInterfaceInfo
) -> Result<NativeModuleInstance<'a, Owned>, Error> where
    MO: AccessIdentifier
[src]

Loads the module.

Failure

The function can fail if some module invariant is not met.

Return

Handle on success, error otherwise.

Safety

The function crosses the ffi boundary. Direct usage of a NativeModule may break some invariants of the module api, if not handled with care.

pub unsafe fn unload(
    &mut self,
    instance: NativeModuleInstance<'_, Owned>
) -> Result<(), Error>
[src]

Unloads the module.

Failure

The function can fail if some module invariant is not met or instance is invalid.

Return

Error on failure.

Safety

The function crosses the ffi boundary. Direct usage of a NativeModule may break some invariants of the module api, if not handled with care.

pub unsafe fn initialize(
    &mut self,
    instance: &mut NativeModuleInstance<'_, Owned>
) -> Result<(), Error>
[src]

Initializes the module.

Failure

The function can fail if some module invariant is not met or instance is invalid.

Return

Error on failure.

Safety

The function crosses the ffi boundary. Direct usage of a NativeModule may break some invariants of the module api, if not handled with care.

pub unsafe fn terminate(
    &mut self,
    instance: &mut NativeModuleInstance<'_, Owned>
) -> Result<(), Error>
[src]

Terminates the module.

Failure

The function can fail if some module invariant is not met or instance is invalid.

Return

Error on failure.

Safety

The function crosses the ffi boundary. Direct usage of a NativeModule may break some invariants of the module api, if not handled with care.

impl<'a, O> NativeModule<'a, O> where
    O: ImmutableAccessIdentifier
[src]

pub unsafe fn get_interface<'instance, IO, T>(
    &self,
    instance: &'instance NativeModuleInstance<'instance, IO>,
    interface: &InterfaceDescriptor,
    caster: impl FnOnce(Interface) -> T
) -> Result<Interface<'instance, T>, Error> where
    IO: ImmutableAccessIdentifier
[src]

Fetches an interface from the module.

Failure

The function fails if instance is invalid.

Return

Interface on success, error otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary. Direct usage of a NativeModule may break some invariants of the module api, if not handled with care.

pub unsafe fn get_module_info<'instance, IO>(
    &self,
    instance: &'instance NativeModuleInstance<'instance, IO>
) -> Result<&'instance ModuleInfo, Error> where
    IO: ImmutableAccessIdentifier
[src]

Fetches the module info of the module.

Failure

The function fails if instance is invalid.

Return

Module info on success, error otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary. Direct usage of a NativeModule may break some invariants of the module api, if not handled with care.

pub unsafe fn get_load_dependencies(&self) -> &'a [InterfaceDescriptor][src]

Fetches the load dependencies of the module.

Return

Load dependencies.

Safety

The function crosses the ffi boundary. Direct usage of a NativeModule may break some invariants of the module api, if not handled with care.

pub unsafe fn get_runtime_dependencies<'instance, IO>(
    &self,
    instance: &'instance NativeModuleInstance<'instance, IO>
) -> Result<&'instance [InterfaceDescriptor], Error> where
    IO: ImmutableAccessIdentifier
[src]

Fetches the runtime dependencies of the module.

Failure

The function fails if instance is invalid.

Return

Runtime dependencies on success, error otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary. Direct usage of a NativeModule may break some invariants of the module api, if not handled with care.

pub unsafe fn get_exportable_interfaces<'instance, IO>(
    &self,
    instance: &'instance NativeModuleInstance<'instance, IO>
) -> Result<&'instance [InterfaceDescriptor], Error> where
    IO: ImmutableAccessIdentifier
[src]

Fetches the exportable interfaces of the module.

Failure

The function fails if instance is invalid.

Return

Exportable interfaces on success, error otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary. Direct usage of a NativeModule may break some invariants of the module api, if not handled with care.

Methods from Deref<Target = NonNullConst<NativeModuleInterfaceFFI>>

pub unsafe fn into_mut(&self) -> NonNull<T>[src]

Acquires a mutable version of the pointer.

Safety

It is undefined behavior if the underlying pointer is not already mutable.

pub unsafe fn as_ref(&self) -> &T[src]

Returns a shared reference to the value.

Safety

The same restrictions as NonNull::as_ref apply.

Trait Implementations

impl<'a, O: Clone> Clone for NativeModule<'a, O>[src]

impl<'a, O: Copy> Copy for NativeModule<'a, O>[src]

impl<'a, O: Debug> Debug for NativeModule<'a, O>[src]

impl<O> Deref for NativeModule<'_, O>[src]

type Target = NonNullConst<NativeModuleInterfaceFFI>

The resulting type after dereferencing.

impl<O> DerefMut for NativeModule<'_, O>[src]

impl<'a, O: Eq> Eq for NativeModule<'a, O>[src]

impl<'a, O: Ord> Ord for NativeModule<'a, O>[src]

impl<'a, O: PartialEq> PartialEq<NativeModule<'a, O>> for NativeModule<'a, O>[src]

impl<'a, O: PartialOrd> PartialOrd<NativeModule<'a, O>> for NativeModule<'a, O>[src]

impl<O> Send for NativeModule<'_, O>[src]

impl<'a, O> StructuralEq for NativeModule<'a, O>[src]

impl<'a, O> StructuralPartialEq for NativeModule<'a, O>[src]

impl<O> Sync for NativeModule<'_, O>[src]

Auto Trait Implementations

impl<'a, O> RefUnwindSafe for NativeModule<'a, O> where
    O: RefUnwindSafe

impl<'a, O> Unpin for NativeModule<'a, O>

impl<'a, O> UnwindSafe for NativeModule<'a, O> where
    O: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.