pub struct PluginLoader { /* private fields */ }Expand description
Plugin loader for managing dynamic plugin loading
Implementations§
Source§impl PluginLoader
impl PluginLoader
Sourcepub const CURRENT_API_VERSION: u32 = 1
pub const CURRENT_API_VERSION: u32 = 1
Current API version
Sourcepub fn add_search_path<P: AsRef<Path>>(&mut self, path: P)
pub fn add_search_path<P: AsRef<Path>>(&mut self, path: P)
Add a search path for plugins
Sourcepub fn set_unsafe_mode(&mut self, enabled: bool)
pub fn set_unsafe_mode(&mut self, enabled: bool)
Enable unsafe mode (skip validation)
Sourcepub fn find_plugin(&self, name: &str) -> Option<PathBuf>
pub fn find_plugin(&self, name: &str) -> Option<PathBuf>
Find plugin file by name
Sourcepub async fn load_library<P: AsRef<Path>>(
&self,
path: P,
) -> Result<Arc<PluginLibrary>, PluginLoadError>
pub async fn load_library<P: AsRef<Path>>( &self, path: P, ) -> Result<Arc<PluginLibrary>, PluginLoadError>
Sourcepub async fn unload_library<P: AsRef<Path>>(
&self,
path: P,
) -> Result<(), PluginLoadError>
pub async fn unload_library<P: AsRef<Path>>( &self, path: P, ) -> Result<(), PluginLoadError>
Unload a plugin library
Sourcepub async fn has_changed<P: AsRef<Path>>(
&self,
path: P,
) -> Result<bool, PluginLoadError>
pub async fn has_changed<P: AsRef<Path>>( &self, path: P, ) -> Result<bool, PluginLoadError>
Check if a library has changed
Sourcepub async fn get_library<P: AsRef<Path>>(
&self,
path: P,
) -> Option<Arc<PluginLibrary>>
pub async fn get_library<P: AsRef<Path>>( &self, path: P, ) -> Option<Arc<PluginLibrary>>
Get a loaded library
Sourcepub async fn list_libraries(&self) -> Vec<PathBuf>
pub async fn list_libraries(&self) -> Vec<PathBuf>
List all loaded libraries
Sourcepub async fn create_plugin<P: AsRef<Path>>(
&self,
path: P,
) -> Result<DynamicPlugin, PluginLoadError>
pub async fn create_plugin<P: AsRef<Path>>( &self, path: P, ) -> Result<DynamicPlugin, PluginLoadError>
Create a plugin instance from a loaded library
Sourcepub async fn reload_library<P: AsRef<Path>>(
&self,
path: P,
) -> Result<Arc<PluginLibrary>, PluginLoadError>
pub async fn reload_library<P: AsRef<Path>>( &self, path: P, ) -> Result<Arc<PluginLibrary>, PluginLoadError>
Reload a plugin library
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PluginLoader
impl !RefUnwindSafe for PluginLoader
impl Send for PluginLoader
impl Sync for PluginLoader
impl Unpin for PluginLoader
impl UnsafeUnpin for PluginLoader
impl !UnwindSafe for PluginLoader
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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