Trait emf_core_base_rs::library::library_loader::LibraryLoaderAPI [−][src]
pub trait LibraryLoaderAPI<'a> { type InternalLoader; fn to_interface(&self) -> NonNullConst<LibraryLoaderInterface>; unsafe fn from_interface(
handler: NonNullConst<LibraryLoaderInterface>
) -> Self; unsafe fn from_void_ptr(handler: NonNullConst<c_void>) -> Self; unsafe fn load(
&mut self,
path: &impl AsRef<Path>
) -> Result<InternalLibrary<Owned>, Error>; unsafe fn unload(
&mut self,
internal: InternalLibrary<Owned>
) -> Result<(), Error>; unsafe fn get_data_symbol<O, U>(
&self,
internal: &InternalLibrary<O>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(NonNullConst<c_void>) -> &'a U
) -> Result<Symbol<'a, &'a U>, Error>
where
O: ImmutableAccessIdentifier; unsafe fn get_function_symbol<O, U>(
&self,
internal: &InternalLibrary<O>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(CBaseFn) -> U
) -> Result<Symbol<'a, U>, Error>
where
O: ImmutableAccessIdentifier; unsafe fn get_internal_interface(&self) -> Self::InternalLoader; }
The API of a library loader.
Associated Types
type InternalLoader
[src]
Type of the internal loader.
Required methods
fn to_interface(&self) -> NonNullConst<LibraryLoaderInterface>
[src]
Fetches a pointer that can be used with the interface.
unsafe fn from_interface(handler: NonNullConst<LibraryLoaderInterface>) -> Self
[src]
unsafe fn from_void_ptr(handler: NonNullConst<c_void>) -> Self
[src]
unsafe fn load(
&mut self,
path: &impl AsRef<Path>
) -> Result<InternalLibrary<Owned>, Error>
[src]
&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 LibraryLoaderAPI may break some invariants of the library api, if not handled with care.
unsafe fn unload(
&mut self,
internal: InternalLibrary<Owned>
) -> Result<(), Error>
[src]
&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 LibraryLoaderAPI may break some invariants of the library api, if not handled with care.
unsafe fn get_data_symbol<O, U>(
&self,
internal: &InternalLibrary<O>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(NonNullConst<c_void>) -> &'a U
) -> Result<Symbol<'a, &'a U>, Error> where
O: ImmutableAccessIdentifier,
[src]
&self,
internal: &InternalLibrary<O>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(NonNullConst<c_void>) -> &'a U
) -> Result<Symbol<'a, &'a U>, Error> where
O: 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 LibraryLoaderAPI::get_function_symbol() for fetching a function.
Return
Symbol on success, error otherwise.
Safety
The function crosses the ffi boundary. Direct usage of a LibraryLoaderAPI may break some invariants of the library api, if not handled with care.
unsafe fn get_function_symbol<O, U>(
&self,
internal: &InternalLibrary<O>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(CBaseFn) -> U
) -> Result<Symbol<'a, U>, Error> where
O: ImmutableAccessIdentifier,
[src]
&self,
internal: &InternalLibrary<O>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(CBaseFn) -> U
) -> Result<Symbol<'a, U>, Error> where
O: 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 LibraryLoaderAPI::get_data_symbol() for fetching some data.
Return
Symbol on success, error otherwise.
Safety
The function crosses the ffi boundary. Direct usage of a LibraryLoaderAPI may break some invariants of the library api, if not handled with care.
unsafe fn get_internal_interface(&self) -> Self::InternalLoader
[src]
Fetches a pointer to the internal interface.
Return
Pointer to the interface.
Safety
The function crosses the ffi boundary. Direct usage of a LibraryLoaderAPI may break some invariants of the library api, if not handled with care.
Implementors
impl<'a> LibraryLoaderAPI<'a> for NativeLoader<'a>
[src]
impl<'a> LibraryLoaderAPI<'a> for NativeLoader<'a>
[src]type InternalLoader = NativeLoaderInternal<'a>
fn to_interface(&self) -> NonNullConst<LibraryLoaderInterface>
[src]
unsafe fn from_interface(
interface: NonNullConst<LibraryLoaderInterface>
) -> Self
[src]
interface: NonNullConst<LibraryLoaderInterface>
) -> Self
unsafe fn from_void_ptr(interface: NonNullConst<c_void>) -> Self
[src]
unsafe fn load(
&mut self,
path: &impl AsRef<Path>
) -> Result<InternalLibrary<Owned>, Error>
[src]
&mut self,
path: &impl AsRef<Path>
) -> Result<InternalLibrary<Owned>, Error>
unsafe fn unload(
&mut self,
internal: InternalLibrary<Owned>
) -> Result<(), Error>
[src]
&mut self,
internal: InternalLibrary<Owned>
) -> Result<(), Error>
unsafe fn get_data_symbol<O, U>(
&self,
internal: &InternalLibrary<O>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(NonNullConst<c_void>) -> &'a U
) -> Result<Symbol<'a, &'a U>, Error> where
O: ImmutableAccessIdentifier,
[src]
&self,
internal: &InternalLibrary<O>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(NonNullConst<c_void>) -> &'a U
) -> Result<Symbol<'a, &'a U>, Error> where
O: ImmutableAccessIdentifier,
unsafe fn get_function_symbol<O, U>(
&self,
internal: &InternalLibrary<O>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(CBaseFn) -> U
) -> Result<Symbol<'a, U>, Error> where
O: ImmutableAccessIdentifier,
[src]
&self,
internal: &InternalLibrary<O>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(CBaseFn) -> U
) -> Result<Symbol<'a, U>, Error> where
O: ImmutableAccessIdentifier,
unsafe fn get_internal_interface(&self) -> Self::InternalLoader
[src]
impl<'a> LibraryLoaderAPI<'a> for NativeLoaderInternal<'a>
[src]
impl<'a> LibraryLoaderAPI<'a> for NativeLoaderInternal<'a>
[src]type InternalLoader = Self
fn to_interface(&self) -> NonNullConst<LibraryLoaderInterface>
[src]
unsafe fn from_interface(
interface: NonNullConst<LibraryLoaderInterface>
) -> Self
[src]
interface: NonNullConst<LibraryLoaderInterface>
) -> Self
unsafe fn from_void_ptr(interface: NonNullConst<c_void>) -> Self
[src]
unsafe fn load(
&mut self,
path: &impl AsRef<Path>
) -> Result<InternalLibrary<Owned>, Error>
[src]
&mut self,
path: &impl AsRef<Path>
) -> Result<InternalLibrary<Owned>, Error>
unsafe fn unload(
&mut self,
internal: InternalLibrary<Owned>
) -> Result<(), Error>
[src]
&mut self,
internal: InternalLibrary<Owned>
) -> Result<(), Error>
unsafe fn get_data_symbol<O, U>(
&self,
internal: &InternalLibrary<O>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(NonNullConst<c_void>) -> &'a U
) -> Result<Symbol<'a, &'a U>, Error> where
O: ImmutableAccessIdentifier,
[src]
&self,
internal: &InternalLibrary<O>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(NonNullConst<c_void>) -> &'a U
) -> Result<Symbol<'a, &'a U>, Error> where
O: ImmutableAccessIdentifier,
unsafe fn get_function_symbol<O, U>(
&self,
internal: &InternalLibrary<O>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(CBaseFn) -> U
) -> Result<Symbol<'a, U>, Error> where
O: ImmutableAccessIdentifier,
[src]
&self,
internal: &InternalLibrary<O>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(CBaseFn) -> U
) -> Result<Symbol<'a, U>, Error> where
O: ImmutableAccessIdentifier,
unsafe fn get_internal_interface(&self) -> Self::InternalLoader
[src]
impl<'a> LibraryLoaderAPI<'a> for UnknownLoader<'a>
[src]
impl<'a> LibraryLoaderAPI<'a> for UnknownLoader<'a>
[src]type InternalLoader = InvalidLoader
fn to_interface(&self) -> NonNullConst<LibraryLoaderInterface>
[src]
unsafe fn from_interface(
interface: NonNullConst<LibraryLoaderInterface>
) -> Self
[src]
interface: NonNullConst<LibraryLoaderInterface>
) -> Self
unsafe fn from_void_ptr(interface: NonNullConst<c_void>) -> Self
[src]
unsafe fn load(
&mut self,
path: &impl AsRef<Path>
) -> Result<InternalLibrary<Owned>, Error>
[src]
&mut self,
path: &impl AsRef<Path>
) -> Result<InternalLibrary<Owned>, Error>
unsafe fn unload(
&mut self,
internal: InternalLibrary<Owned>
) -> Result<(), Error>
[src]
&mut self,
internal: InternalLibrary<Owned>
) -> Result<(), Error>
unsafe fn get_data_symbol<O, U>(
&self,
internal: &InternalLibrary<O>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(NonNullConst<c_void>) -> &'a U
) -> Result<Symbol<'a, &'a U>, Error> where
O: ImmutableAccessIdentifier,
[src]
&self,
internal: &InternalLibrary<O>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(NonNullConst<c_void>) -> &'a U
) -> Result<Symbol<'a, &'a U>, Error> where
O: ImmutableAccessIdentifier,
unsafe fn get_function_symbol<O, U>(
&self,
internal: &InternalLibrary<O>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(CBaseFn) -> U
) -> Result<Symbol<'a, U>, Error> where
O: ImmutableAccessIdentifier,
[src]
&self,
internal: &InternalLibrary<O>,
symbol: &impl AsRef<CStr>,
caster: impl FnOnce(CBaseFn) -> U
) -> Result<Symbol<'a, U>, Error> where
O: ImmutableAccessIdentifier,