pub struct RustPluginLoader { /* private fields */ }Expand description
A Rust plugin loaded from a cdylib shared library.
The shared library must export a create_plugin function with the signature:
extern "C" fn() -> *mut dyn Plugin
Implementations§
Source§impl RustPluginLoader
impl RustPluginLoader
pub fn new() -> Self
Sourcepub unsafe fn load(
&mut self,
path: &Path,
) -> Result<&dyn Plugin, Box<dyn Error + Send + Sync>>
pub unsafe fn load( &mut self, path: &Path, ) -> Result<&dyn Plugin, Box<dyn Error + Send + Sync>>
Load a Rust plugin from a cdylib shared library at the given path.
The library must export: extern "C" fn create_plugin() -> *mut dyn Plugin
§Safety
This function loads and executes arbitrary code from a shared library. The caller must ensure the library is trusted and compatible.
Sourcepub fn into_plugins(self) -> Vec<Box<dyn Plugin>>
pub fn into_plugins(self) -> Vec<Box<dyn Plugin>>
Consume the loader and return all loaded plugins.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RustPluginLoader
impl !RefUnwindSafe for RustPluginLoader
impl Send for RustPluginLoader
impl Sync for RustPluginLoader
impl Unpin for RustPluginLoader
impl UnsafeUnpin for RustPluginLoader
impl !UnwindSafe for RustPluginLoader
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