Expand description
§Plux - Extensible Plugin System for Rust
Plux is a comprehensive plugin system for Rust applications, offering a robust and flexible architecture for extending application functionality through plugins. It enables seamless integration of third-party code while maintaining security and stability.
§Key Features
- Language Agnostic: Write plugins in any programming language
- Hot Reloading: Update plugins without restarting the host application
- Dynamic Loading: Load and unload plugins at runtime
- Type Safety: Rust’s type system ensures safe plugin interactions
- Cross-Platform: Works on all major platforms (Windows, macOS, Linux)
- Performance Optimized: Efficient loading and caching of plugins
- Isolated Execution: Secure sandboxing for plugin execution
§Core Components
- Loader: Central component for managing plugin lifecycle and execution
- Manager: Adapters providing standardized interfaces for plugin integration
- Plugin: Self-contained modules that extend application functionality
§Quick Start
use plux_rs::prelude::*;
use plux_lua_manager::LuaManager;
#[function]
fn add(_: (), a: &i32, b: &i32) -> i32 {
a + b
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut loader = SimpleLoader::new();
loader.context(move |mut ctx| {
ctx.register_manager(LuaManager::new())?;
ctx.register_function(add());
// Load and manage plugins here
Ok::<(), Box<dyn std::error::Error>>(())
})?;
Ok(())
}
Re-exports§
pub use context::*;
Modules§
- context
- Context types used during plugin loading and registration.
- function
- Function and request definitions for the plugin system.
- prelude
- Re-export of common types for plugin implementation. This module provides convenient access to the most commonly used types when implementing plugins.
- utils
- Utility types and functions for the plugin system.
- variable
- Variable types used for data exchange between plugins and host.
Macros§
- function_
call - Macro for convenient function calling with automatic argument conversion.
Structs§
- Api
- API interface provided to plugins during loading.
- Bundle
- Represents a plugin bundle with its metadata.
- Depend
- Represents a dependency on another plugin.
- Loader
- Main loader for plugins and managers.
- Plugin
- Represents a loaded plugin instance.
- Plugin
Info - Complete information about a plugin.
- StdInfo
- Standard implementation of the Info trait.
Traits§
- Info
- Trait for plugin information and dependencies.
- Manager
- Trait for implementing custom plugin managers.
Type Aliases§
- Registry
- Registry of functions that can be called by plugins. This type alias represents a collection of functions exposed by the host application that plugins can invoke during execution.
- Requests
- Collection of function requests from plugins. This type alias represents a collection of requests that plugins can make to the host application, typically for accessing host-provided functionality.
- Simple
Loader - A convenience type alias for a Loader with commonly used default type parameters.
Attribute Macros§
- function
- Re-exports for procedural macros when the
derive
feature is enabled.