Expand description
Beancount WASM Plugin Runtime.
This crate provides a plugin system for extending Beancount’s functionality. Plugins can be written in any language that compiles to WebAssembly, or as native Rust code for maximum performance.
§Architecture
The plugin system uses wasmtime as the WASM runtime with MessagePack
serialization for passing data across the WASM boundary.
§Plugin Types
- WASM Plugins: Sandboxed plugins loaded from
.wasmfiles - Native Plugins: Built-in plugins implemented in Rust
§Built-in Plugins (30)
See the plugin reference for the full list.
§Example
ⓘ
use rustledger_plugin::{PluginManager, PluginInput, PluginOptions};
let mut manager = PluginManager::new();
manager.load(Path::new("my_plugin.wasm"))?;
let input = PluginInput {
directives: vec![],
options: PluginOptions::default(),
config: None,
};
let output = manager.execute_all(input)?;Re-exports§
pub use convert::ConversionError;pub use convert::directive_to_wrapper;pub use convert::directive_to_wrapper_with_location;pub use convert::directives_to_wrappers;pub use convert::wrapper_to_directive;pub use convert::wrappers_to_directives;pub use native::DocumentDiscoveryPlugin;pub use native::NativePlugin;pub use native::NativePluginRegistry;pub use runtime::Plugin;pub use runtime::PluginManager;pub use runtime::RuntimeConfig;pub use runtime::WatchingPluginManager;pub use runtime::validate_plugin_module;
Modules§
- convert
- Conversion between core types and plugin serialization types.
- native
- Native (non-WASM) plugin support.
- runtime
- WASM Plugin Runtime.
- types
- Plugin interface types.
Structs§
- Plugin
Error - Error generated by a plugin.
- Plugin
Input - Input passed to a plugin.
- Plugin
Options - Ledger options passed to plugins.
- Plugin
Output - Output returned from a plugin.
Enums§
- Plugin
Error Severity - Severity of a plugin error.