Struct emf_core_base_rs::library::library_loader::LibraryLoader[][src]

pub struct LibraryLoader<T, O> { /* fields omitted */ }

A library loader.

Implementations

impl<'a, T, O> LibraryLoader<T, O> where
    T: LibraryLoaderAPI<'a>,
    O: AccessIdentifier
[src]

pub fn to_interface(&self) -> NonNullConst<LibraryLoaderInterface>[src]

Fetches a pointer that can be used with the interface.

pub unsafe fn from_interface(
    handler: NonNullConst<LibraryLoaderInterface>
) -> Self
[src]

Construct a new instance from a pointer.

Safety

This function should not be used directly.

pub unsafe fn from_void_ptr(handler: NonNullConst<c_void>) -> Self[src]

Construct a new instance from a void pointer.

Safety

This function should not be used directly.

impl<'a, T, O> LibraryLoader<T, O> where
    T: LibraryLoaderAPI<'a>,
    O: MutableAccessIdentifier
[src]

pub unsafe fn load(
    &mut self,
    path: &impl AsRef<Path>
) -> Result<InternalLibrary<Owned>, Error>
[src]

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.

pub unsafe fn unload(
    &mut self,
    internal: InternalLibrary<Owned>
) -> Result<(), Error>
[src]

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.

impl<'a, T, O> LibraryLoader<T, O> where
    T: LibraryLoaderAPI<'a>,
    O: ImmutableAccessIdentifier
[src]

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
[src]

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.

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
[src]

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.

pub unsafe fn get_internal_interface(
    &self
) -> LibraryLoader<T::InternalLoader, O>
[src]

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

impl<T: Clone, O: Clone> Clone for LibraryLoader<T, O>[src]

impl<T: Copy, O: Copy> Copy for LibraryLoader<T, O>[src]

impl<T: Debug, O: Debug> Debug for LibraryLoader<T, O>[src]

impl<'a, T, O> Deref for LibraryLoader<T, O> where
    T: LibraryLoaderAPI<'a>,
    O: AccessIdentifier
[src]

type Target = T

The resulting type after dereferencing.

impl<'a, T, O> DerefMut for LibraryLoader<T, O> where
    T: LibraryLoaderAPI<'a>,
    O: MutableAccessIdentifier
[src]

impl<T: Eq, O: Eq> Eq for LibraryLoader<T, O>[src]

impl<T: Ord, O: Ord> Ord for LibraryLoader<T, O>[src]

impl<T: PartialEq, O: PartialEq> PartialEq<LibraryLoader<T, O>> for LibraryLoader<T, O>[src]

impl<T: PartialOrd, O: PartialOrd> PartialOrd<LibraryLoader<T, O>> for LibraryLoader<T, O>[src]

impl<T, O> StructuralEq for LibraryLoader<T, O>[src]

impl<T, O> StructuralPartialEq for LibraryLoader<T, O>[src]

Auto Trait Implementations

impl<T, O> RefUnwindSafe for LibraryLoader<T, O> where
    O: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, O> !Send for LibraryLoader<T, O>

impl<T, O> !Sync for LibraryLoader<T, O>

impl<T, O> Unpin for LibraryLoader<T, O> where
    T: Unpin

impl<T, O> UnwindSafe for LibraryLoader<T, O> where
    O: RefUnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.