Expand description
Language-agnostic plugin system for gravityfile.
This crate provides a trait-based plugin architecture that supports multiple scripting language runtimes (Lua, Rhai, and WASM).
§Architecture
The plugin system is built around the PluginRuntime trait, which defines
the interface that any scripting language runtime must implement. This allows
users to write plugins in their preferred language.
§Plugin Types
- Analyzers: Custom file/directory analysis (async, returns data)
- Previewers: File content preview generation (async, isolated)
- Actions: Custom file operations (async with progress)
- Renderers: Custom column/cell rendering (sync)
- Filters: Search/filter plugins (sync/async)
- Hooks: Event listeners (sync callbacks)
§Example
ⓘ
use gravityfile_plugin::{PluginManager, PluginConfig};
let config = PluginConfig::default();
let mut manager = PluginManager::new(config)?;
// Load plugins from user config directory
manager.discover_plugins().await?;
// Dispatch a hook to all registered plugins
manager.dispatch_hook(&Hook::OnScanComplete { tree }).await?;Modules§
- lua
- Lua plugin runtime implementation.
- rhai
- Rhai plugin runtime implementation.
- wasm
- WebAssembly plugin runtime.
Structs§
- Hook
Context - Context provided to plugins when a hook is invoked.
- Hook
Result - Result returned by a plugin hook handler.
- Plugin
Config - Global plugin system configuration.
- Plugin
Handle - A handle to a loaded plugin.
- Plugin
Manager - Manager for all plugin runtimes and loaded plugins.
- Plugin
Metadata - Metadata about a plugin from its plugin.toml file.
- Sandbox
Config - Configuration for plugin sandboxing.
Enums§
- Hook
- Events that plugins can hook into.
- Permission
- Permission types that can be granted to plugins.
- Plugin
Error - Errors that can occur in the plugin system.
- Plugin
Kind - Categories of plugins.
- Value
- A dynamic value that can be passed between Rust and plugin runtimes.
Traits§
- Isolated
Context - An isolated execution context for running plugin code safely.
- Plugin
Runtime - Trait that all plugin runtime implementations must satisfy.
Type Aliases§
- Plugin
Result - Result type for plugin operations.