| Crates.io | plugrs |
| lib.rs | plugrs |
| version | 0.1.1 |
| created_at | 2025-01-15 06:14:17.012282+00 |
| updated_at | 2025-01-15 06:36:59.04318+00 |
| description | A lightweight and type-safe plugin system for Rust |
| homepage | |
| repository | https://github.com/Lydanne/plugrs |
| max_upload_size | |
| id | 1517152 |
| size | 9,910 |
A lightweight and type-safe plugin system for Rust.
Add this to your Cargo.toml:
[dependencies]
plugrs = "0.1.0"
Creating a plugin:
use plugrs::prelude::*;
#[plugin]
pub struct MyPlugin;
impl Plugin for MyPlugin {
fn name(&self) -> String {
"My Plugin".to_string()
}
fn execute(&self) -> i32 {
42
}
}
Loading and using plugins:
use plugrs::PluginManager;
fn main() {
let manager = PluginManager::new();
// Load a plugin from a dynamic library
let plugin = manager.load_plugin("path/to/plugin.so").unwrap();
// Execute the plugin
let result = plugin.execute();
println!("Plugin result: {}", result);
}
This project is licensed under the MIT License - see the LICENSE file for details.