Skip to main content

Crate gravityfile_plugin

Crate gravityfile_plugin 

Source
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§

HookContext
Context provided to plugins when a hook is invoked.
HookResult
Result returned by a plugin hook handler.
PluginConfig
Global plugin system configuration.
PluginHandle
A handle to a loaded plugin.
PluginManager
Manager for all plugin runtimes and loaded plugins.
PluginMetadata
Metadata about a plugin from its plugin.toml file.
SandboxConfig
Configuration for plugin sandboxing.

Enums§

Hook
Events that plugins can hook into.
Permission
Permission types that can be granted to plugins.
PluginError
Errors that can occur in the plugin system.
PluginKind
Categories of plugins.
Value
A dynamic value that can be passed between Rust and plugin runtimes.

Traits§

IsolatedContext
An isolated execution context for running plugin code safely.
PluginRuntime
Trait that all plugin runtime implementations must satisfy.

Type Aliases§

PluginResult
Result type for plugin operations.