pub struct LibraryLoader<T, O> { /* private fields */ }
Expand description
A library loader.
Implementations§
Source§impl<'a, T, O> LibraryLoader<T, O>where
T: LibraryLoaderAPI<'a>,
O: AccessIdentifier,
impl<'a, T, O> LibraryLoader<T, O>where
T: LibraryLoaderAPI<'a>,
O: AccessIdentifier,
Sourcepub fn to_interface(&self) -> NonNullConst<LibraryLoaderInterface>
pub fn to_interface(&self) -> NonNullConst<LibraryLoaderInterface>
Fetches a pointer that can be used with the interface.
Sourcepub unsafe fn from_interface(
handler: NonNullConst<LibraryLoaderInterface>,
) -> Self
pub unsafe fn from_interface( handler: NonNullConst<LibraryLoaderInterface>, ) -> Self
Sourcepub unsafe fn from_void_ptr(handler: NonNullConst<c_void>) -> Self
pub unsafe fn from_void_ptr(handler: NonNullConst<c_void>) -> Self
Source§impl<'a, T, O> LibraryLoader<T, O>where
T: LibraryLoaderAPI<'a>,
O: MutableAccessIdentifier,
impl<'a, T, O> LibraryLoader<T, O>where
T: LibraryLoaderAPI<'a>,
O: MutableAccessIdentifier,
Sourcepub unsafe fn load(
&mut self,
path: &impl AsRef<Path>,
) -> Result<InternalLibrary<Owned>, Error>
pub unsafe fn load( &mut self, path: &impl AsRef<Path>, ) -> Result<InternalLibrary<Owned>, 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 crosses the ffi boundary. Direct usage of a LibraryLoader may break some invariants of the library api, if not handled with care.
Sourcepub unsafe fn unload(
&mut self,
internal: InternalLibrary<Owned>,
) -> Result<(), Error>
pub unsafe fn unload( &mut self, internal: InternalLibrary<Owned>, ) -> Result<(), Error>
Unloads a library.
§Failure
The function fails if internal
is invalid.
§Return
Error on failure.
§Safety
The function crosses the ffi boundary. Direct usage of a LibraryLoader may break some invariants of the library api, if not handled with care.
Source§impl<'a, T, O> LibraryLoader<T, O>where
T: LibraryLoaderAPI<'a>,
O: ImmutableAccessIdentifier,
impl<'a, T, O> LibraryLoader<T, O>where
T: LibraryLoaderAPI<'a>,
O: ImmutableAccessIdentifier,
Sourcepub unsafe fn get_data_symbol<LO, U>(
&self,
internal: &InternalLibrary<LO>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(NonNullConst<c_void>) -> &'a U,
) -> Result<Symbol<'a, &'a U>, Error>where
LO: ImmutableAccessIdentifier,
pub unsafe fn get_data_symbol<LO, U>(
&self,
internal: &InternalLibrary<LO>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(NonNullConst<c_void>) -> &'a U,
) -> Result<Symbol<'a, &'a U>, Error>where
LO: ImmutableAccessIdentifier,
Fetches a data symbol from a library.
§Failure
The function fails if internal
is invalid or library does not contain symbol
.
§Note
Some platforms may differentiate between a function-pointer
and a data-pointer
.
See LibraryLoader::get_function_symbol() for fetching a function.
§Return
Symbol on success, error otherwise.
§Safety
The function crosses the ffi boundary. Direct usage of a LibraryLoader may break some invariants of the library api, if not handled with care.
Sourcepub unsafe fn get_function_symbol<LO, U>(
&self,
internal: &InternalLibrary<LO>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(CBaseFn) -> U,
) -> Result<Symbol<'a, U>, Error>where
LO: ImmutableAccessIdentifier,
pub unsafe fn get_function_symbol<LO, U>(
&self,
internal: &InternalLibrary<LO>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(CBaseFn) -> U,
) -> Result<Symbol<'a, U>, Error>where
LO: ImmutableAccessIdentifier,
Fetches a function symbol from a library.
§Failure
The function fails if internal
is invalid or library does not contain symbol
.
§Note
Some platforms may differentiate between a function-pointer
and a data-pointer
.
See LibraryLoader::get_data_symbol() for fetching some data.
§Return
Symbol on success, error otherwise.
§Safety
The function crosses the ffi boundary. Direct usage of a LibraryLoader may break some invariants of the library api, if not handled with care.
Sourcepub unsafe fn get_internal_interface(
&self,
) -> LibraryLoader<T::InternalLoader, O>
pub unsafe fn get_internal_interface( &self, ) -> LibraryLoader<T::InternalLoader, O>
Fetches a pointer to the internal interface.
§Return
Pointer to the interface.
§Safety
The function crosses the ffi boundary. Direct usage of a LibraryLoader may break some invariants of the library api, if not handled with care.
Trait Implementations§
Source§impl<T: Clone, O: Clone> Clone for LibraryLoader<T, O>
impl<T: Clone, O: Clone> Clone for LibraryLoader<T, O>
Source§fn clone(&self) -> LibraryLoader<T, O>
fn clone(&self) -> LibraryLoader<T, O>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more