Trait emf_core_base_rs_ffi::module::api::ModuleBinding[][src]

pub trait ModuleBinding {
Show methods unsafe fn register_loader(
        &mut self,
        loader: NonNullConst<ModuleLoaderInterface>,
        mod_type: NonNullConst<ModuleType>
    ) -> Result<LoaderHandle, Error>;
unsafe fn unregister_loader(
        &mut self,
        loader: LoaderHandle
    ) -> Result<i8, Error>;
unsafe fn get_loader_interface(
        &mut self,
        loader: LoaderHandle
    ) -> Result<NonNullConst<ModuleLoaderInterface>, Error>;
unsafe fn get_loader_handle_from_type(
        &self,
        mod_type: NonNullConst<ModuleType>
    ) -> Result<LoaderHandle, Error>;
unsafe fn get_loader_handle_from_module(
        &self,
        handle: ModuleHandle
    ) -> Result<LoaderHandle, Error>;
unsafe fn get_num_modules(&self) -> usize;
unsafe fn get_num_loaders(&self) -> usize;
unsafe fn get_num_exported_interfaces(&self) -> usize;
unsafe fn module_exists(&self, handle: ModuleHandle) -> Bool;
unsafe fn type_exists(&self, mod_type: NonNullConst<ModuleType>) -> Bool;
unsafe fn exported_interface_exists(
        &self,
        interface: NonNullConst<InterfaceDescriptor>
    ) -> Bool;
unsafe fn get_modules(
        &self,
        buffer: NonNull<MutSpan<ModuleInfo>>
    ) -> Result<usize, Error>;
unsafe fn get_module_types(
        &self,
        buffer: NonNull<MutSpan<ModuleType>>
    ) -> Result<usize, Error>;
unsafe fn get_exported_interfaces(
        &self,
        buffer: NonNull<MutSpan<InterfaceDescriptor>>
    ) -> Result<usize, Error>;
unsafe fn get_exported_interface_handle(
        &self,
        interface: NonNullConst<InterfaceDescriptor>
    ) -> Result<ModuleHandle, Error>;
unsafe fn create_module_handle(&mut self) -> ModuleHandle;
unsafe fn remove_module_handle(
        &mut self,
        handle: ModuleHandle
    ) -> Result<i8, Error>;
unsafe fn link_module(
        &mut self,
        handle: ModuleHandle,
        loader: LoaderHandle,
        internal: InternalHandle
    ) -> Result<i8, Error>;
unsafe fn get_internal_module_handle(
        &self,
        handle: ModuleHandle
    ) -> Result<InternalHandle, Error>;
unsafe fn add_module(
        &mut self,
        loader: LoaderHandle,
        path: NonNullConst<OSPathChar>
    ) -> Result<ModuleHandle, Error>;
unsafe fn remove_module(
        &mut self,
        handle: ModuleHandle
    ) -> Result<i8, Error>;
unsafe fn load(&mut self, handle: ModuleHandle) -> Result<i8, Error>;
unsafe fn unload(&mut self, handle: ModuleHandle) -> Result<i8, Error>;
unsafe fn initialize(&mut self, handle: ModuleHandle) -> Result<i8, Error>;
unsafe fn terminate(&mut self, handle: ModuleHandle) -> Result<i8, Error>;
unsafe fn add_dependency(
        &mut self,
        handle: ModuleHandle,
        interface: NonNullConst<InterfaceDescriptor>
    ) -> Result<i8, Error>;
unsafe fn remove_dependency(
        &mut self,
        handle: ModuleHandle,
        interface: NonNullConst<InterfaceDescriptor>
    ) -> Result<i8, Error>;
unsafe fn export_interface(
        &mut self,
        handle: ModuleHandle,
        interface: NonNullConst<InterfaceDescriptor>
    ) -> Result<i8, Error>;
unsafe fn get_load_dependencies(
        &self,
        handle: ModuleHandle
    ) -> Result<ConstSpan<InterfaceDescriptor>, Error>;
unsafe fn get_runtime_dependencies(
        &self,
        handle: ModuleHandle
    ) -> Result<ConstSpan<InterfaceDescriptor>, Error>;
unsafe fn get_exportable_interfaces(
        &self,
        handle: ModuleHandle
    ) -> Result<ConstSpan<InterfaceDescriptor>, Error>;
unsafe fn fetch_status(
        &self,
        handle: ModuleHandle
    ) -> Result<ModuleStatus, Error>;
unsafe fn get_module_path(
        &self,
        handle: ModuleHandle
    ) -> Result<NonNullConst<OSPathChar>, Error>;
unsafe fn get_module_info(
        &self,
        handle: ModuleHandle
    ) -> Result<NonNullConst<ModuleInfo>, Error>;
unsafe fn get_interface(
        &self,
        handle: ModuleHandle,
        interface: NonNullConst<InterfaceDescriptor>
    ) -> Result<Interface, Error>;
}

Helper trait for using the module api.

Required methods

unsafe fn register_loader(
    &mut self,
    loader: NonNullConst<ModuleLoaderInterface>,
    mod_type: NonNullConst<ModuleType>
) -> Result<LoaderHandle, Error>
[src]

Registers a new module loader.

Module types starting with __ are reserved for future use.

Failure

The function fails if mod_type already exists.

Return

Handle on success, error otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn unregister_loader(
    &mut self,
    loader: LoaderHandle
) -> Result<i8, Error>
[src]

Unregisters an existing module loader.

Unregistering a module loader also unloads the modules it loaded.

Failure

The function fails if loader is invalid.

Return

Error on failure.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn get_loader_interface(
    &mut self,
    loader: LoaderHandle
) -> Result<NonNullConst<ModuleLoaderInterface>, Error>
[src]

Fetches the interface of a module loader.

Failure

The function fails if loader is invalid.

Return

Interface on success, error otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn get_loader_handle_from_type(
    &self,
    mod_type: NonNullConst<ModuleType>
) -> Result<LoaderHandle, Error>
[src]

Fetches the handle of the loader associated with a module type.

Failure

The function fails if mod_type does not exist.

Return

Handle on success, error otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn get_loader_handle_from_module(
    &self,
    handle: ModuleHandle
) -> Result<LoaderHandle, Error>
[src]

Fetches the handle of the loader linked with the module handle.

Failure

The function fails if handle is invalid.

Return

Handle on success, error otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn get_num_modules(&self) -> usize[src]

Fetches the number of loaded modules.

Return

Number of modules.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn get_num_loaders(&self) -> usize[src]

Fetches the number of loaders.

Return

Number of module loaders.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn get_num_exported_interfaces(&self) -> usize[src]

Fetches the number of exported interfaces.

Return

Number of exported interfaces.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn module_exists(&self, handle: ModuleHandle) -> Bool[src]

Checks if a module exists.

Return

Bool::True if it exists, Bool::False otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn type_exists(&self, mod_type: NonNullConst<ModuleType>) -> Bool[src]

Checks if a module type exists.

Return

Bool::True if it exists, Bool::False otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn exported_interface_exists(
    &self,
    interface: NonNullConst<InterfaceDescriptor>
) -> Bool
[src]

Checks whether an exported interface exists.

Return

Bool::True if it exists, Bool::False otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn get_modules(
    &self,
    buffer: NonNull<MutSpan<ModuleInfo>>
) -> Result<usize, Error>
[src]

Copies the available module info into a buffer.

Failure

Fails if buffer.as_ref().len() < get_num_modules().

Return

Number if written module info on success, error otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn get_module_types(
    &self,
    buffer: NonNull<MutSpan<ModuleType>>
) -> Result<usize, Error>
[src]

Copies the available module types into a buffer.

Failure

Fails if buffer.as_ref().len() < get_num_loaders().

Return

Number if written module types on success, error otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn get_exported_interfaces(
    &self,
    buffer: NonNull<MutSpan<InterfaceDescriptor>>
) -> Result<usize, Error>
[src]

Copies the descriptors of the exported interfaces into a buffer.

Failure

Fails if buffer.as_ref().len() < get_num_exported_interfaces().

Return

Number if written descriptors on success, error otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn get_exported_interface_handle(
    &self,
    interface: NonNullConst<InterfaceDescriptor>
) -> Result<ModuleHandle, Error>
[src]

Fetches the module handle of the exported interface.

Failure

Fails if interface does not exist.

Return

Module handle on success, error otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn create_module_handle(&mut self) -> ModuleHandle[src]

Creates a new unlinked module handle.

Note

The handle must be linked before use.

Return

Module handle.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn remove_module_handle(
    &mut self,
    handle: ModuleHandle
) -> Result<i8, Error>
[src]

Removes an existing module handle.

Failure

Fails if handle is invalid.

Note

Removing the handle does not unload the module.

Return

Error on failure.

Safety

The function is not thread-safe and crosses the ffi boundary.

Links a module handle to an internal module handle.

Failure

Fails if handle orloader are invalid.

Note

Incorrect usage can lead to dangling handles or use-after-free errors.

Return

Error on failure.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn get_internal_module_handle(
    &self,
    handle: ModuleHandle
) -> Result<InternalHandle, Error>
[src]

Fetches the internal handle linked with the module handle.

Failure

Fails if handle is invalid.

Return

Internal handle on success, error otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn add_module(
    &mut self,
    loader: LoaderHandle,
    path: NonNullConst<OSPathChar>
) -> Result<ModuleHandle, Error>
[src]

Adds a new module.

Failure

Fails if loader or 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 is not thread-safe and crosses the ffi boundary.

unsafe fn remove_module(&mut self, handle: ModuleHandle) -> Result<i8, 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 is not thread-safe and crosses the ffi boundary.

unsafe fn load(&mut self, handle: ModuleHandle) -> Result<i8, Error>[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 is not thread-safe and crosses the ffi boundary.

unsafe fn unload(&mut self, handle: ModuleHandle) -> Result<i8, Error>[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 is not thread-safe and crosses the ffi boundary.

unsafe fn initialize(&mut self, handle: ModuleHandle) -> Result<i8, Error>[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 is not thread-safe and crosses the ffi boundary.

unsafe fn terminate(&mut self, handle: ModuleHandle) -> Result<i8, Error>[src]

Terminates a module.

Terminating a module also removes the interfaces it exported. The modules that depend on the module are terminated. If they list the module as a load dependency, they are also unloaded.

Failure

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

Return

Error on failure.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn add_dependency(
    &mut self,
    handle: ModuleHandle,
    interface: NonNullConst<InterfaceDescriptor>
) -> Result<i8, Error>
[src]

Registers a new runtime dependency of the module.

Failure

Fails if handle is invalid.

Return

Error on failure.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn remove_dependency(
    &mut self,
    handle: ModuleHandle,
    interface: NonNullConst<InterfaceDescriptor>
) -> Result<i8, Error>
[src]

Removes an existing runtime dependency from the module.

Failure

Fails if handle is invalid.

Return

Error on failure.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn export_interface(
    &mut self,
    handle: ModuleHandle,
    interface: NonNullConst<InterfaceDescriptor>
) -> Result<i8, Error>
[src]

Exports an interface of a module.

Failure

Fails if handle is invalid, interface is already exported, interface is not contained in the module or the module is not yet initialized.

Return

Error on failure.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn get_load_dependencies(
    &self,
    handle: ModuleHandle
) -> Result<ConstSpan<InterfaceDescriptor>, Error>
[src]

Fetches the load dependencies of a module.

Failure

Fails if handle is invalid.

Return

Load dependencies on success, error otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn get_runtime_dependencies(
    &self,
    handle: ModuleHandle
) -> Result<ConstSpan<InterfaceDescriptor>, Error>
[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 is not thread-safe and crosses the ffi boundary.

unsafe fn get_exportable_interfaces(
    &self,
    handle: ModuleHandle
) -> Result<ConstSpan<InterfaceDescriptor>, Error>
[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 is not thread-safe and crosses the ffi boundary.

unsafe fn fetch_status(
    &self,
    handle: ModuleHandle
) -> Result<ModuleStatus, Error>
[src]

Fetches the load status of a module.

Failure

Fails if handle is invalid.

Return

Module status on success, error otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn get_module_path(
    &self,
    handle: ModuleHandle
) -> Result<NonNullConst<OSPathChar>, Error>
[src]

Fetches the path a module was loaded from.

Failure

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

Return

Module path on success, error otherwise.

Safety

The function is not thread-safe and crosses the ffi boundary.

unsafe fn get_module_info(
    &self,
    handle: ModuleHandle
) -> Result<NonNullConst<ModuleInfo>, Error>
[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 is not thread-safe and crosses the ffi boundary.

unsafe fn get_interface(
    &self,
    handle: ModuleHandle,
    interface: NonNullConst<InterfaceDescriptor>
) -> Result<Interface, Error>
[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 is not thread-safe and crosses the ffi boundary.

Loading content...

Implementors

impl ModuleBinding for CBaseInterface[src]

Loading content...