Skip to main content

Crate postscriptum

Crate postscriptum 

Source
Expand description

§postscriptum

A multi-interpreted-language scripting engine for Rust, with Rhai and Python backends, working on both native and WASM targets. This crate is Bevy-free.

The core abstraction is the ScriptEngine trait: a stateful interpreter that evaluates a script and returns the result as a string. Wrap it in a ThreadSafeEngine to share it across threads, and expose Rust functions to scripts through a FunctionBundle.

See the rhai module for a runnable example (requires the rhai feature).

Re-exports§

pub use error::Error;
pub use error::ExprIssue;
pub use error::ExprIssueKind;
pub use error::LimitKind;
pub use error::Result;
pub use error::ValidationError;
pub use function_bundle::FunctionBundle;
pub use rhai::BoundedRhaiEngine;
pub use rhai::CompiledExpr;
pub use rhai::DEFAULT_MAX_ARRAY_SIZE;
pub use rhai::DEFAULT_MAX_CALL_LEVELS;
pub use rhai::DEFAULT_MAX_MAP_SIZE;
pub use rhai::DEFAULT_MAX_OPERATIONS;
pub use rhai::DEFAULT_MAX_STRING_SIZE;
pub use rhai::from_dynamic_value;
pub use rhai::to_dynamic_value;

Modules§

error
Error types for postscriptum. Error types for postscriptum.
function_bundle
A unified bundle of Rust functions callable from scripts.
python
The Python backend (native via pyo3, WASM via Pyodide).
rhai
The Rhai scripting backend.

Structs§

ThreadSafeEngine
Wrapper that makes non-Send engines usable across threads.

Enums§

EngineType
The set of scripting backends available.

Constants§

DEFAULT_MAX_SOURCE_LEN
Starting default for the source-length cap in bytes (Quartertone bound): enforced host-side before compiling/evaluating on both backends. Dynamically settable everywhere it matters (builder field on BoundedRhaiEngine, parameter on Python compile) — a starting value, not fixed policy.

Traits§

ScriptEngine
The core interface every scripting backend implements.

Functions§

get_engine
Create a bare engine of the given type (no registered functions).
get_engine_with_bundle
Create an engine of the given type with bundle’s functions registered.