postscriptum 0.1.1

Multi-interpreted-language scripting engine for Rust with Rhai and Python backends
Documentation
# postscriptum

A **multi-interpreted-language scripting engine for Rust**.

`postscriptum` lets you embed scripting into your Rust application and register
Rust functions callable from the scripts. It is **Bevy-free** and works on
**native** and **WASM** targets.

Currently two backends are implemented:

| Language   | Native           | WASM                 |
| ---------- | ---------------- | -------------------- |
| **Rhai**   | rhai (pure Rust) | rhai (pure Rust)     |
| **Python** | pyo3             | Pyodide (JS interop) |

## Quickstart

The shortest possible example — create an engine and evaluate a script:

```rust,no_run
use postscriptum::{EngineType, get_engine};

let mut engine = get_engine(EngineType::Rhai);
assert_eq!(engine.eval("40 + 2")?, "42");
# Ok::<(), postscriptum::Error>(())
```

See **[QUICKSTART.md](QUICKSTART.md)** for the full guide: the core concept,
registering Rust functions callable from scripts (`FunctionBundle`,
`add_*_fn0..4`), keeping interpreter state between runs, sharing engines across
threads (`ThreadSafeEngine`), and native vs WASM notes.

## Examples

Runnable examples live in [`examples/`](examples/):

- **`basic_rhai`** — evaluate a Rhai script and call a registered Rust function.
- **`basic_python`** — the same with the Python backend.
- **`thread_safe`** — share a single `ThreadSafeEngine` across threads.

Run them from the crate root, e.g. `cargo run --example basic_rhai`
(`basic_python` needs the `python` feature, which is on by default).

## Features

- `rhai` — enables the Rhai backend (pure Rust, always available). _(default)_
- `python` — enables the native Python backend via `pyo3` _(default)_; on WASM
  this is a no-op, since the WASM Python backend uses `wasm-bindgen`/Pyodide.
- `wasm-python` — marker for the WASM Python (Pyodide) backend.
- `native-python` — convenience alias for `python`.

## How it works

- [`ScriptEngine`] — the core trait: `fn eval(&mut self, &str) -> Result<String>`.
  Each backend (`RhaiEngine`, `PythonEngine`) implements it and keeps
  **interpreter state** between `eval` calls.
- [`ThreadSafeEngine`] — a `Clone` wrapper around
  `Arc<Mutex<Box<dyn ScriptEngine>>>` that makes the (non-`Send`) Python engine
  usable across threads.
- [`FunctionBundle`] — the language-tagged way to expose Rust functions to
  scripts (`add_rhai_fn0..4` / `add_python_fn0..4`), with per-language
  registration into the engine.
- [`EngineType`] — `Rhai | Python` (extensible).

## License

MIT OR Apache-2.0