plugrs

Crates.ioplugrs
lib.rsplugrs
version0.1.1
created_at2025-01-15 06:14:17.012282+00
updated_at2025-01-15 06:36:59.04318+00
descriptionA lightweight and type-safe plugin system for Rust
homepage
repositoryhttps://github.com/Lydanne/plugrs
max_upload_size
id1517152
size9,910
Lyda (Lydanne)

documentation

https://docs.rs/plugrs

README

plugrs

A lightweight and type-safe plugin system for Rust.

Features

  • Type-safe plugin interface
  • Dynamic plugin loading
  • Thread-safe plugin execution
  • Procedural macros for plugin development
  • Error handling and recovery
  • Zero-cost abstractions

Usage

Add this to your Cargo.toml:

[dependencies]
plugrs = "0.1.0"

Example

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);
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

Commit count: 28

cargo fmt