Trait emf_core_base_rs::module::module_loader::ModuleLoaderAPI[][src]

pub trait ModuleLoaderAPI<'a> {
    type InternalLoader;
Show methods fn to_interface(&self) -> NonNullConst<ModuleLoaderInterface>;
unsafe fn from_interface(
        handler: NonNullConst<ModuleLoaderInterface>
    ) -> Self;
unsafe fn from_void_ptr(handler: NonNullConst<c_void>) -> Self;
unsafe fn add_module(
        &mut self,
        path: &impl AsRef<Path>
    ) -> Result<InternalModule<Owned>, Error>;
unsafe fn remove_module(
        &mut self,
        module: InternalModule<Owned>
    ) -> Result<(), Error>;
unsafe fn load<O>(
        &mut self,
        module: &mut InternalModule<O>
    ) -> Result<(), Error>
    where
        O: MutableAccessIdentifier
;
unsafe fn unload<O>(
        &mut self,
        module: &mut InternalModule<O>
    ) -> Result<(), Error>
    where
        O: MutableAccessIdentifier
;
unsafe fn initialize<O>(
        &mut self,
        module: &mut InternalModule<O>
    ) -> Result<(), Error>
    where
        O: MutableAccessIdentifier
;
unsafe fn terminate<O>(
        &mut self,
        module: &mut InternalModule<O>
    ) -> Result<(), Error>
    where
        O: MutableAccessIdentifier
;
unsafe fn fetch_status<O>(
        &self,
        module: &InternalModule<O>
    ) -> Result<ModuleStatus, Error>
    where
        O: ImmutableAccessIdentifier
;
unsafe fn get_interface<'module, O, T>(
        &self,
        module: &'module InternalModule<O>,
        interface: &InterfaceDescriptor,
        caster: impl FnOnce(Interface) -> T
    ) -> Result<Interface<'module, T>, Error>
    where
        O: ImmutableAccessIdentifier
;
unsafe fn get_module_info<'module, O>(
        &self,
        module: &'module InternalModule<O>
    ) -> Result<&'module ModuleInfo, Error>
    where
        O: ImmutableAccessIdentifier
;
unsafe fn get_module_path<'module, O>(
        &self,
        module: &'module InternalModule<O>
    ) -> Result<&'module [OSPathChar], Error>
    where
        O: ImmutableAccessIdentifier
;
unsafe fn get_load_dependencies<'module, O>(
        &self,
        module: &'module InternalModule<O>
    ) -> Result<&'module [InterfaceDescriptor], Error>
    where
        O: ImmutableAccessIdentifier
;
unsafe fn get_runtime_dependencies<'module, O>(
        &self,
        module: &'module InternalModule<O>
    ) -> Result<&'module [InterfaceDescriptor], Error>
    where
        O: ImmutableAccessIdentifier
;
unsafe fn get_exportable_interfaces<'module, O>(
        &self,
        module: &'module InternalModule<O>
    ) -> Result<&'module [InterfaceDescriptor], Error>
    where
        O: ImmutableAccessIdentifier
;
unsafe fn get_internal_interface(&self) -> Self::InternalLoader;
}

The API of a module loader.

Associated Types

type InternalLoader[src]

Type of the internal loader.

Loading content...

Required methods

fn to_interface(&self) -> NonNullConst<ModuleLoaderInterface>[src]

Fetches a pointer that can be used with the interface.

unsafe fn from_interface(handler: NonNullConst<ModuleLoaderInterface>) -> Self[src]

Construct a new instance from a pointer.

Safety

This function should not be used directly.

unsafe fn from_void_ptr(handler: NonNullConst<c_void>) -> Self[src]

Construct a new instance from a void pointer.

Safety

This function should not be used directly.

unsafe fn add_module(
    &mut self,
    path: &impl AsRef<Path>
) -> Result<InternalModule<Owned>, Error>
[src]

Adds a new module.

Failure

Fails if path is invalid or the type of the module can not be loaded with the loader.

Return

Module handle on success, error otherwise.

Safety

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

unsafe fn remove_module(
    &mut self,
    module: InternalModule<Owned>
) -> Result<(), Error>
[src]

Removes a module.

Failure

Fails if handle is invalid or the module is not in an unloaded state.

Return

Error on failure.

Safety

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

unsafe fn load<O>(
    &mut self,
    module: &mut InternalModule<O>
) -> Result<(), Error> where
    O: MutableAccessIdentifier
[src]

Loads a module.

Failure

Fails if handle is invalid, the load dependencies of the module are not exported or the module is not in an unloaded state.

Return

Error on failure.

Safety

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

unsafe fn unload<O>(
    &mut self,
    module: &mut InternalModule<O>
) -> Result<(), Error> where
    O: MutableAccessIdentifier
[src]

Unloads a module.

Failure

Fails if handle is invalid or the module is in an unloaded or ready state.

Return

Error on failure.

Safety

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

unsafe fn initialize<O>(
    &mut self,
    module: &mut InternalModule<O>
) -> Result<(), Error> where
    O: MutableAccessIdentifier
[src]

Initializes a module.

Failure

Fails if handle is invalid, the runtime dependencies of the module are not exported or the module is not in a loaded state.

Return

Error on failure.

Safety

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

unsafe fn terminate<O>(
    &mut self,
    module: &mut InternalModule<O>
) -> Result<(), Error> where
    O: MutableAccessIdentifier
[src]

Terminates a module.

Failure

Fails if handle is invalid or the module is not in a ready state.

Return

Error on failure.

Safety

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

unsafe fn fetch_status<O>(
    &self,
    module: &InternalModule<O>
) -> Result<ModuleStatus, Error> where
    O: ImmutableAccessIdentifier
[src]

Fetches the load status of a module.

Failure

Fails if handle is invalid.

Return

Module status on success, error otherwise.

Safety

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

unsafe fn get_interface<'module, O, T>(
    &self,
    module: &'module InternalModule<O>,
    interface: &InterfaceDescriptor,
    caster: impl FnOnce(Interface) -> T
) -> Result<Interface<'module, T>, Error> where
    O: ImmutableAccessIdentifier
[src]

Fetches an interface from a module.

Failure

Fails if handle is invalid, the module is not in a ready state or the interface is not contained in the module.

Return

Interface on success, error otherwise.

Safety

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

unsafe fn get_module_info<'module, O>(
    &self,
    module: &'module InternalModule<O>
) -> Result<&'module ModuleInfo, Error> where
    O: ImmutableAccessIdentifier
[src]

Fetches the module info from a module.

Failure

Fails if handle is invalid or the module is not yet loaded.

Return

Module info on success, error otherwise.

Safety

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

unsafe fn get_module_path<'module, O>(
    &self,
    module: &'module InternalModule<O>
) -> Result<&'module [OSPathChar], Error> where
    O: ImmutableAccessIdentifier
[src]

Fetches the path a module was loaded from.

The resulting slice is terminated with a \0 character.

Failure

Fails if handle is invalid or the module is not yet loaded.

Return

Module path on success, error otherwise.

Safety

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

unsafe fn get_load_dependencies<'module, O>(
    &self,
    module: &'module InternalModule<O>
) -> Result<&'module [InterfaceDescriptor], Error> where
    O: ImmutableAccessIdentifier
[src]

Fetches the load dependencies of a module.

Failure

Fails if handle is invalid.

Return

Load dependencies on success, error otherwise.

Safety

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

unsafe fn get_runtime_dependencies<'module, O>(
    &self,
    module: &'module InternalModule<O>
) -> Result<&'module [InterfaceDescriptor], Error> where
    O: ImmutableAccessIdentifier
[src]

Fetches the runtime dependencies of a module.

Failure

Fails if handle is invalid or the module is not yet loaded.

Return

Runtime dependencies on success, error otherwise.

Safety

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

unsafe fn get_exportable_interfaces<'module, O>(
    &self,
    module: &'module InternalModule<O>
) -> Result<&'module [InterfaceDescriptor], Error> where
    O: ImmutableAccessIdentifier
[src]

Fetches the exportable interfaces of a module.

Failure

Fails if handle is invalid or the module is not yet loaded.

Return

Exportable interfaces on success, error otherwise.

Safety

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

unsafe fn get_internal_interface(&self) -> Self::InternalLoader[src]

Fetches a pointer to the internal loader interface.

Return

Pointer to the loader interface.

Safety

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

Loading content...

Implementors

impl<'a> ModuleLoaderAPI<'a> for NativeLoader<'a>[src]

type InternalLoader = NativeLoaderInternal<'a>

impl<'a> ModuleLoaderAPI<'a> for NativeLoaderInternal<'a>[src]

type InternalLoader = Self

impl<'a> ModuleLoaderAPI<'a> for UnknownLoader<'a>[src]

type InternalLoader = InvalidLoader

Loading content...