Skip to main content

martensite_plugin/
lib.rs

1//! WebAssembly plugin runtime for Martensite.
2//!
3//! This crate embeds a Wasmtime sandbox and exposes a zero-allocation shared
4//! memory ring buffer so that third-party widgets can push paint commands at
5//! 60 Hz / 120 Hz without host-trampoline overhead. Plugins run with a fuel
6//! budget and epoch-based interruption, and every host call is validated against
7//! an explicit capability set.
8//!
9//! The crate is written entirely in safe Rust.
10#![forbid(unsafe_code)]
11#![deny(missing_docs)]
12
13/// Zero-allocation shared-memory ring buffer for paint commands.
14pub mod ring_buffer;
15/// Wasmtime sandbox, WASIp1 context, and plugin instance lifecycle.
16pub mod runtime;
17/// Capability-based security model and builder API.
18pub mod security;
19
20pub use ring_buffer::{
21    PluginPaintCmd, PluginRingBuffer, RingBufferError, DEFAULT_CAPACITY, SHARED_HEADER_SIZE,
22};
23pub use runtime::{
24    PluginError, PluginInstance, PluginRuntime, PluginState, DEFAULT_FUEL_BUDGET,
25    RING_BUFFER_REGION_SIZE,
26};
27pub use security::{Capability, CapabilitySet, PluginBuilder};