pub struct NativeModule<'a, O> { /* private fields */ }Expand description
A native module.
Implementations§
Source§impl<O> NativeModule<'_, O>where
O: AccessIdentifier,
impl<O> NativeModule<'_, O>where
O: AccessIdentifier,
Sourcepub const unsafe fn new(
interface: NonNullConst<NativeModuleInterfaceFFI>,
) -> Self
pub const unsafe fn new( interface: NonNullConst<NativeModuleInterfaceFFI>, ) -> Self
Construct a new instance from an interface.
§Safety
This function allows the creation of invalid modules by bypassing lifetimes.
Source§impl NativeModule<'_, Owned>
impl NativeModule<'_, Owned>
Sourcepub const fn as_borrowed(&self) -> NativeModule<'_, BorrowImmutable<'_>>
pub const fn as_borrowed(&self) -> NativeModule<'_, BorrowImmutable<'_>>
Borrows the module interface.
Sourcepub fn as_borrowed_mut(&mut self) -> NativeModule<'_, BorrowMutable<'_>>
pub fn as_borrowed_mut(&mut self) -> NativeModule<'_, BorrowMutable<'_>>
Borrows the module interface mutably.
Source§impl<'a, O> NativeModule<'a, O>where
O: MutableAccessIdentifier,
impl<'a, O> NativeModule<'a, O>where
O: MutableAccessIdentifier,
Sourcepub unsafe fn load<MO>(
&mut self,
module: &Module<'_, MO>,
interface: &impl CBaseInterfaceInfo,
) -> Result<NativeModuleInstance<'a, Owned>, Error>where
MO: AccessIdentifier,
pub unsafe fn load<MO>(
&mut self,
module: &Module<'_, MO>,
interface: &impl CBaseInterfaceInfo,
) -> Result<NativeModuleInstance<'a, Owned>, Error>where
MO: AccessIdentifier,
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.
Sourcepub unsafe fn unload(
&mut self,
instance: NativeModuleInstance<'_, Owned>,
) -> Result<(), Error>
pub unsafe fn unload( &mut self, instance: NativeModuleInstance<'_, Owned>, ) -> Result<(), Error>
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.
Sourcepub unsafe fn initialize(
&mut self,
instance: &mut NativeModuleInstance<'_, Owned>,
) -> Result<(), Error>
pub unsafe fn initialize( &mut self, instance: &mut NativeModuleInstance<'_, Owned>, ) -> Result<(), Error>
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.
Sourcepub unsafe fn terminate(
&mut self,
instance: &mut NativeModuleInstance<'_, Owned>,
) -> Result<(), Error>
pub unsafe fn terminate( &mut self, instance: &mut NativeModuleInstance<'_, Owned>, ) -> Result<(), Error>
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.
Source§impl<'a, O> NativeModule<'a, O>where
O: ImmutableAccessIdentifier,
impl<'a, O> NativeModule<'a, O>where
O: ImmutableAccessIdentifier,
Sourcepub 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,
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,
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.
Sourcepub unsafe fn get_module_info<'instance, IO>(
&self,
instance: &'instance NativeModuleInstance<'instance, IO>,
) -> Result<&'instance ModuleInfo, Error>where
IO: ImmutableAccessIdentifier,
pub unsafe fn get_module_info<'instance, IO>(
&self,
instance: &'instance NativeModuleInstance<'instance, IO>,
) -> Result<&'instance ModuleInfo, Error>where
IO: ImmutableAccessIdentifier,
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.
Sourcepub unsafe fn get_load_dependencies(&self) -> &'a [InterfaceDescriptor]
pub unsafe fn get_load_dependencies(&self) -> &'a [InterfaceDescriptor]
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.
Sourcepub unsafe fn get_runtime_dependencies<'instance, IO>(
&self,
instance: &'instance NativeModuleInstance<'instance, IO>,
) -> Result<&'instance [InterfaceDescriptor], Error>where
IO: ImmutableAccessIdentifier,
pub unsafe fn get_runtime_dependencies<'instance, IO>(
&self,
instance: &'instance NativeModuleInstance<'instance, IO>,
) -> Result<&'instance [InterfaceDescriptor], Error>where
IO: ImmutableAccessIdentifier,
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.
Sourcepub unsafe fn get_exportable_interfaces<'instance, IO>(
&self,
instance: &'instance NativeModuleInstance<'instance, IO>,
) -> Result<&'instance [InterfaceDescriptor], Error>where
IO: ImmutableAccessIdentifier,
pub unsafe fn get_exportable_interfaces<'instance, IO>(
&self,
instance: &'instance NativeModuleInstance<'instance, IO>,
) -> Result<&'instance [InterfaceDescriptor], Error>where
IO: ImmutableAccessIdentifier,
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>>§
Trait Implementations§
Source§impl<'a, O: Clone> Clone for NativeModule<'a, O>
impl<'a, O: Clone> Clone for NativeModule<'a, O>
Source§fn clone(&self) -> NativeModule<'a, O>
fn clone(&self) -> NativeModule<'a, O>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more