pub struct LibLoader { /* private fields */ }
Expand description
LibLoader allows search for libraries and to load them.
Implementations§
Source§impl LibLoader
impl LibLoader
Sourcepub fn new(dirs: LibSearchDirs) -> LibLoader
pub fn new(dirs: LibSearchDirs) -> LibLoader
Creates a new LibLoader with a set of paths where the libraries will be searched for.
If exe_parent_dir
is true, the parent directory of the current executable is also added
to the set of paths for search.
Sourcepub fn search_paths(&self) -> Option<&[PathBuf]>
pub fn search_paths(&self) -> Option<&[PathBuf]>
Return the list of search paths used by this LibLoader
Sourcepub unsafe fn load_file(path: &str) -> ZResult<(Library, PathBuf)>
pub unsafe fn load_file(path: &str) -> ZResult<(Library, PathBuf)>
Load a library from the specified path.
§Safety
This function calls libloading::Library::new() which is unsafe.
Sourcepub unsafe fn search_and_load(
&self,
name: &str,
) -> ZResult<Option<(Library, PathBuf)>>
pub unsafe fn search_and_load( &self, name: &str, ) -> ZResult<Option<(Library, PathBuf)>>
Search for library with filename: LIB_PREFIX+name
+LIB_SUFFIX and load it.
The result is a tuple with:
- the Library
- its full path
§Safety
This function calls libloading::Library::new() which is unsafe.
Sourcepub unsafe fn load_all_with_prefix(
&self,
prefix: Option<&str>,
) -> Option<Vec<(Library, PathBuf, String)>>
pub unsafe fn load_all_with_prefix( &self, prefix: Option<&str>, ) -> Option<Vec<(Library, PathBuf, String)>>
Search and load all libraries with filename starting with LIB_PREFIX+prefix
and ending with LIB_SUFFIX.
The result is a list of tuple with:
- the Library
- its full path
- its short name (i.e. filename stripped of prefix and suffix)
§Safety
This function calls libloading::Library::new() which is unsafe.
pub fn _plugin_name(path: &Path) -> Option<&str>
pub fn plugin_name<P>(path: &P) -> Option<&str>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LibLoader
impl RefUnwindSafe for LibLoader
impl Send for LibLoader
impl Sync for LibLoader
impl Unpin for LibLoader
impl UnwindSafe for LibLoader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more