pub struct NativePluginLoader;Expand description
Loader for native plugins.
Provides methods to load plugins from shared libraries or bundles.
Implementations§
Source§impl NativePluginLoader
impl NativePluginLoader
Sourcepub fn load<P: AsRef<Path>>(path: P) -> ConsumerResult<NativePlugin>
pub fn load<P: AsRef<Path>>(path: P) -> ConsumerResult<NativePlugin>
Sourcepub fn load_with_config<P: AsRef<Path>>(
path: P,
config: &PluginConfig,
log_callback: Option<LogCallbackFn>,
) -> ConsumerResult<NativePlugin>
pub fn load_with_config<P: AsRef<Path>>( path: P, config: &PluginConfig, log_callback: Option<LogCallbackFn>, ) -> ConsumerResult<NativePlugin>
Load a plugin with custom configuration.
§Arguments
path- Path to the shared libraryconfig- Plugin configurationlog_callback- Optional callback to receive log messages
§Example
ⓘ
let config = PluginConfig::default();
let log_callback: LogCallbackFn = Arc::new(|level, target, msg| {
println!("[{level}] {target}: {msg}");
});
let plugin = NativePluginLoader::load_with_config(
"target/release/libmy_plugin.so",
&config,
Some(log_callback),
)?;Sourcepub fn load_bundle<P: AsRef<Path>>(
bundle_path: P,
) -> ConsumerResult<NativePlugin>
pub fn load_bundle<P: AsRef<Path>>( bundle_path: P, ) -> ConsumerResult<NativePlugin>
Sourcepub fn load_bundle_with_config<P: AsRef<Path>>(
bundle_path: P,
config: &PluginConfig,
log_callback: Option<LogCallbackFn>,
) -> ConsumerResult<NativePlugin>
pub fn load_bundle_with_config<P: AsRef<Path>>( bundle_path: P, config: &PluginConfig, log_callback: Option<LogCallbackFn>, ) -> ConsumerResult<NativePlugin>
Load a plugin from a bundle with custom configuration.
§Arguments
bundle_path- Path to the .rbp bundle fileconfig- Plugin configurationlog_callback- Optional callback to receive log messages
§Example
ⓘ
let config = PluginConfig::default();
let plugin = NativePluginLoader::load_bundle_with_config(
"my-plugin-1.0.0.rbp",
&config,
None,
)?;Sourcepub fn load_bundle_variant_with_config<P: AsRef<Path>>(
bundle_path: P,
variant: &str,
config: &PluginConfig,
log_callback: Option<LogCallbackFn>,
) -> ConsumerResult<NativePlugin>
pub fn load_bundle_variant_with_config<P: AsRef<Path>>( bundle_path: P, variant: &str, config: &PluginConfig, log_callback: Option<LogCallbackFn>, ) -> ConsumerResult<NativePlugin>
Load a specific variant from a bundle with custom configuration.
Unlike load_bundle_with_config which always extracts the default (release) variant,
this method extracts the named variant (e.g., “debug”, “release”).
§Arguments
bundle_path- Path to the .rbp bundle filevariant- Variant name (e.g., “release”, “debug”)config- Plugin configurationlog_callback- Optional callback to receive log messages
§Example
ⓘ
let config = PluginConfig::default();
let plugin = NativePluginLoader::load_bundle_variant_with_config(
"my-plugin-1.0.0.rbp",
"debug",
&config,
None,
)?;Sourcepub fn load_bundle_to_dir<P: AsRef<Path>, Q: AsRef<Path>>(
bundle_path: P,
extract_dir: Q,
config: &PluginConfig,
log_callback: Option<LogCallbackFn>,
) -> ConsumerResult<NativePlugin>
pub fn load_bundle_to_dir<P: AsRef<Path>, Q: AsRef<Path>>( bundle_path: P, extract_dir: Q, config: &PluginConfig, log_callback: Option<LogCallbackFn>, ) -> ConsumerResult<NativePlugin>
Load a plugin from a bundle to a specific extraction directory.
This is useful when you want to control where the library is extracted.
§Arguments
bundle_path- Path to the .rbp bundle fileextract_dir- Directory to extract the library toconfig- Plugin configurationlog_callback- Optional callback to receive log messages
Sourcepub fn load_bundle_with_verification<P: AsRef<Path>>(
bundle_path: P,
config: &PluginConfig,
log_callback: Option<LogCallbackFn>,
verify_signatures: bool,
public_key_override: Option<&str>,
) -> ConsumerResult<NativePlugin>
pub fn load_bundle_with_verification<P: AsRef<Path>>( bundle_path: P, config: &PluginConfig, log_callback: Option<LogCallbackFn>, verify_signatures: bool, public_key_override: Option<&str>, ) -> ConsumerResult<NativePlugin>
Load a plugin from a bundle with signature verification.
§Arguments
bundle_path- Path to the .rbp bundle fileconfig- Plugin configurationlog_callback- Optional callback to receive log messagesverify_signatures- Whether to verify minisign signaturespublic_key_override- Optional public key to use instead of manifest’s key
§Example
ⓘ
// Load with signature verification (recommended for production)
let plugin = NativePluginLoader::load_bundle_with_verification(
"my-plugin-1.0.0.rbp",
&PluginConfig::default(),
None,
true, // verify signatures
None, // use manifest's public key
)?;Sourcepub fn load_by_name(name: &str) -> ConsumerResult<NativePlugin>
pub fn load_by_name(name: &str) -> ConsumerResult<NativePlugin>
Load a plugin by name, searching standard library paths.
Searches for the library in:
- Current directory
./target/release./target/debug- System library paths (LD_LIBRARY_PATH on Linux, etc.)
§Arguments
name- Library name without prefix/suffix (e.g., “myplugin” finds “libmyplugin.so”)
§Example
ⓘ
// Searches for libmyplugin.so (Linux), libmyplugin.dylib (macOS), myplugin.dll (Windows)
let plugin = NativePluginLoader::load_by_name("myplugin")?;Sourcepub fn load_by_name_with_config(
name: &str,
config: &PluginConfig,
log_callback: Option<LogCallbackFn>,
) -> ConsumerResult<NativePlugin>
pub fn load_by_name_with_config( name: &str, config: &PluginConfig, log_callback: Option<LogCallbackFn>, ) -> ConsumerResult<NativePlugin>
Load a plugin by name with custom configuration.
Auto Trait Implementations§
impl Freeze for NativePluginLoader
impl RefUnwindSafe for NativePluginLoader
impl Send for NativePluginLoader
impl Sync for NativePluginLoader
impl Unpin for NativePluginLoader
impl UnsafeUnpin for NativePluginLoader
impl UnwindSafe for NativePluginLoader
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