Trait emf_core_base_rs_ffi::library::api::LibraryBinding [−][src]
pub trait LibraryBinding {}Show methods
unsafe fn register_loader(
&mut self,
loader: NonNullConst<LibraryLoaderInterface>,
lib_type: NonNullConst<LibraryType>
) -> Result<LoaderHandle, Error>; unsafe fn unregister_loader(
&mut self,
handle: LoaderHandle
) -> Result<i8, Error>; unsafe fn get_loader_interface(
&mut self,
handle: LoaderHandle
) -> Result<NonNullConst<LibraryLoaderInterface>, Error>; unsafe fn get_loader_handle_from_type(
&self,
lib_type: NonNullConst<LibraryType>
) -> Result<LoaderHandle, Error>; unsafe fn get_loader_handle_from_library(
&self,
handle: LibraryHandle
) -> Result<LoaderHandle, Error>; unsafe fn get_num_loaders(&self) -> usize; unsafe fn library_exists(&self, handle: LibraryHandle) -> Bool; unsafe fn type_exists(&self, lib_type: NonNullConst<LibraryType>) -> Bool; unsafe fn get_library_types(
&self,
buffer: NonNull<MutSpan<LibraryType>>
) -> Result<usize, Error>; unsafe fn create_library_handle(&mut self) -> LibraryHandle; unsafe fn remove_library_handle(
&mut self,
handle: LibraryHandle
) -> Result<i8, Error>; unsafe fn link_library(
&mut self,
handle: LibraryHandle,
loader: LoaderHandle,
internal: InternalHandle
) -> Result<i8, Error>; unsafe fn get_internal_library_handle(
&self,
handle: LibraryHandle
) -> Result<InternalHandle, Error>; unsafe fn load(
&mut self,
loader: LoaderHandle,
path: NonNullConst<OSPathChar>
) -> Result<LibraryHandle, Error>; unsafe fn unload(&mut self, handle: LibraryHandle) -> Result<i8, Error>; unsafe fn get_data_symbol(
&self,
handle: LibraryHandle,
symbol: NonNullConst<u8>
) -> Result<Symbol<NonNullConst<c_void>>, Error>; unsafe fn get_function_symbol(
&self,
handle: LibraryHandle,
symbol: NonNullConst<u8>
) -> Result<Symbol<CBaseFn>, Error>;
Helper trait for using the library api.
Required methods
unsafe fn register_loader(
&mut self,
loader: NonNullConst<LibraryLoaderInterface>,
lib_type: NonNullConst<LibraryType>
) -> Result<LoaderHandle, Error>
[src]
&mut self,
loader: NonNullConst<LibraryLoaderInterface>,
lib_type: NonNullConst<LibraryType>
) -> Result<LoaderHandle, Error>
Registers a new loader.
The loader can load libraries of the type lib_type
.
Failure
The function fails if the library 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,
handle: LoaderHandle
) -> Result<i8, Error>
[src]
&mut self,
handle: LoaderHandle
) -> Result<i8, Error>
Unregisters an existing loader.
Failure
The function fails if handle
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,
handle: LoaderHandle
) -> Result<NonNullConst<LibraryLoaderInterface>, Error>
[src]
&mut self,
handle: LoaderHandle
) -> Result<NonNullConst<LibraryLoaderInterface>, Error>
Fetches the interface of a library loader.
Failure
The function fails if handle
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,
lib_type: NonNullConst<LibraryType>
) -> Result<LoaderHandle, Error>
[src]
&self,
lib_type: NonNullConst<LibraryType>
) -> Result<LoaderHandle, Error>
Fetches the loader handle associated with the library type.
Failure
The function fails if lib_type
is not registered.
Return
Handle on success, error otherwise.
Safety
The function is not thread-safe and crosses the ffi boundary.
unsafe fn get_loader_handle_from_library(
&self,
handle: LibraryHandle
) -> Result<LoaderHandle, Error>
[src]
&self,
handle: LibraryHandle
) -> Result<LoaderHandle, Error>
Fetches the loader handle linked with the library 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_loaders(&self) -> usize
[src]
Fetches the number of registered loaders.
Return
Number of registered loaders.
Safety
The function is not thread-safe and crosses the ffi boundary.
unsafe fn library_exists(&self, handle: LibraryHandle) -> Bool
[src]
Checks if a the library handle is valid.
Return
Bool::True if the handle is valid, Bool::False otherwise.
Safety
The function is not thread-safe and crosses the ffi boundary.
unsafe fn type_exists(&self, lib_type: NonNullConst<LibraryType>) -> Bool
[src]
Checks if a library type exists.
Return
Bool::True if the type exists, Bool::False otherwise.
Safety
The function is not thread-safe and crosses the ffi boundary.
unsafe fn get_library_types(
&self,
buffer: NonNull<MutSpan<LibraryType>>
) -> Result<usize, Error>
[src]
&self,
buffer: NonNull<MutSpan<LibraryType>>
) -> Result<usize, Error>
Copies the strings of the registered library types into a buffer.
Failure
The function fails if buffer.as_ref().len() < get_num_loaders()
.
Return
Number of written types on success, error otherwise.
Safety
The function is not thread-safe and crosses the ffi boundary.
unsafe fn create_library_handle(&mut self) -> LibraryHandle
[src]
Creates a new unlinked library handle.
Note
The handle must be linked before use.
Return
Library handle.
Safety
The function is not thread-safe and crosses the ffi boundary.
unsafe fn remove_library_handle(
&mut self,
handle: LibraryHandle
) -> Result<i8, Error>
[src]
&mut self,
handle: LibraryHandle
) -> Result<i8, Error>
Removes an existing library handle.
Failure
The function fails if handle
is invalid.
Note
Removing the handle does not unload the library.
Return
Error on failure.
Safety
The function is not thread-safe and crosses the ffi boundary.
unsafe fn link_library(
&mut self,
handle: LibraryHandle,
loader: LoaderHandle,
internal: InternalHandle
) -> Result<i8, Error>
[src]
&mut self,
handle: LibraryHandle,
loader: LoaderHandle,
internal: InternalHandle
) -> Result<i8, Error>
Links a library handle to an internal library handle.
Overrides the internal link of the library handle by setting it to the new library loader and internal handle.
Failure
The function fails if handle
or loader
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_library_handle(
&self,
handle: LibraryHandle
) -> Result<InternalHandle, Error>
[src]
&self,
handle: LibraryHandle
) -> Result<InternalHandle, Error>
Fetches the internal handle linked with the library 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 load(
&mut self,
loader: LoaderHandle,
path: NonNullConst<OSPathChar>
) -> Result<LibraryHandle, Error>
[src]
&mut self,
loader: LoaderHandle,
path: NonNullConst<OSPathChar>
) -> Result<LibraryHandle, Error>
Loads a library. The resulting handle is unique.
Failure
The function fails if loader
or path
is invalid or
the type of the library can not be loaded with the loader.
Return
Handle on success, error otherwise.
Safety
The function is not thread-safe and crosses the ffi boundary.
unsafe fn unload(&mut self, handle: LibraryHandle) -> Result<i8, Error>
[src]
Unloads a library.
Failure
The function fails if handle
is invalid.
Return
Error on failure.
Safety
The function is not thread-safe and crosses the ffi boundary.
unsafe fn get_data_symbol(
&self,
handle: LibraryHandle,
symbol: NonNullConst<u8>
) -> Result<Symbol<NonNullConst<c_void>>, Error>
[src]
&self,
handle: LibraryHandle,
symbol: NonNullConst<u8>
) -> Result<Symbol<NonNullConst<c_void>>, Error>
Fetches a data symbol from a library.
Failure
The function fails if handle
is invalid or library does not contain symbol
.
Note
Some platforms may differentiate between a function-pointer
and a data-pointer
.
See LibraryBinding::get_function_symbol() for fetching a function.
Return
Symbol on success, error otherwise.
Safety
The function is not thread-safe and crosses the ffi boundary.
unsafe fn get_function_symbol(
&self,
handle: LibraryHandle,
symbol: NonNullConst<u8>
) -> Result<Symbol<CBaseFn>, Error>
[src]
&self,
handle: LibraryHandle,
symbol: NonNullConst<u8>
) -> Result<Symbol<CBaseFn>, Error>
Fetches a function symbol from a library.
Failure
The function fails if handle
is invalid or library does not contain symbol
.
Note
Some platforms may differentiate between a function-pointer
and a data-pointer
.
See LibraryBinding::get_data_symbol() for fetching some data.
Return
Symbol on success, error otherwise.
Safety
The function is not thread-safe and crosses the ffi boundary.
Implementors
impl LibraryBinding for CBaseInterface
[src]
impl LibraryBinding for CBaseInterface
[src]unsafe fn register_loader(
&mut self,
loader: NonNullConst<LibraryLoaderInterface>,
lib_type: NonNullConst<LibraryType>
) -> Result<LoaderHandle, Error>
[src]
&mut self,
loader: NonNullConst<LibraryLoaderInterface>,
lib_type: NonNullConst<LibraryType>
) -> Result<LoaderHandle, Error>
unsafe fn unregister_loader(
&mut self,
handle: LoaderHandle
) -> Result<i8, Error>
[src]
&mut self,
handle: LoaderHandle
) -> Result<i8, Error>
unsafe fn get_loader_interface(
&mut self,
handle: LoaderHandle
) -> Result<NonNullConst<LibraryLoaderInterface>, Error>
[src]
&mut self,
handle: LoaderHandle
) -> Result<NonNullConst<LibraryLoaderInterface>, Error>
unsafe fn get_loader_handle_from_type(
&self,
lib_type: NonNullConst<LibraryType>
) -> Result<LoaderHandle, Error>
[src]
&self,
lib_type: NonNullConst<LibraryType>
) -> Result<LoaderHandle, Error>
unsafe fn get_loader_handle_from_library(
&self,
handle: LibraryHandle
) -> Result<LoaderHandle, Error>
[src]
&self,
handle: LibraryHandle
) -> Result<LoaderHandle, Error>
unsafe fn get_num_loaders(&self) -> usize
[src]
unsafe fn library_exists(&self, handle: LibraryHandle) -> Bool
[src]
unsafe fn type_exists(&self, lib_type: NonNullConst<LibraryType>) -> Bool
[src]
unsafe fn get_library_types(
&self,
buffer: NonNull<MutSpan<LibraryType>>
) -> Result<usize, Error>
[src]
&self,
buffer: NonNull<MutSpan<LibraryType>>
) -> Result<usize, Error>
unsafe fn create_library_handle(&mut self) -> LibraryHandle
[src]
unsafe fn remove_library_handle(
&mut self,
handle: LibraryHandle
) -> Result<i8, Error>
[src]
&mut self,
handle: LibraryHandle
) -> Result<i8, Error>
unsafe fn link_library(
&mut self,
handle: LibraryHandle,
loader: LoaderHandle,
internal: InternalHandle
) -> Result<i8, Error>
[src]
&mut self,
handle: LibraryHandle,
loader: LoaderHandle,
internal: InternalHandle
) -> Result<i8, Error>
unsafe fn get_internal_library_handle(
&self,
handle: LibraryHandle
) -> Result<InternalHandle, Error>
[src]
&self,
handle: LibraryHandle
) -> Result<InternalHandle, Error>
unsafe fn load(
&mut self,
loader: LoaderHandle,
path: NonNullConst<OSPathChar>
) -> Result<LibraryHandle, Error>
[src]
&mut self,
loader: LoaderHandle,
path: NonNullConst<OSPathChar>
) -> Result<LibraryHandle, Error>
unsafe fn unload(&mut self, handle: LibraryHandle) -> Result<i8, Error>
[src]
unsafe fn get_data_symbol(
&self,
handle: LibraryHandle,
symbol: NonNullConst<u8>
) -> Result<Symbol<NonNullConst<c_void>>, Error>
[src]
&self,
handle: LibraryHandle,
symbol: NonNullConst<u8>
) -> Result<Symbol<NonNullConst<c_void>>, Error>
unsafe fn get_function_symbol(
&self,
handle: LibraryHandle,
symbol: NonNullConst<u8>
) -> Result<Symbol<CBaseFn>, Error>
[src]
&self,
handle: LibraryHandle,
symbol: NonNullConst<u8>
) -> Result<Symbol<CBaseFn>, Error>