Skip to main content

Crate ion_core

Crate ion_core 

Source
Expand description

Ion — an embeddable scripting language for Rust.

Ion is a small, strongly-typed scripting language inspired by Starlark, designed for embedding in Rust applications. It features a tree-walk interpreter and an optional bytecode VM for better performance.

§Quick Start

use ion_core::engine::Engine;

let mut engine = Engine::new();
let result = engine.eval("1 + 2").unwrap();
assert_eq!(result, ion_core::value::Value::Int(3));

§Features

  • vm (default) — Bytecode compiler and stack-based VM
  • optimize (default) — Peephole optimizer, constant folding, dead-code elimination, tail-call optimization
  • derive (default) — #[derive(IonType)] for host type injection
  • concurrency — Structured concurrency: async/spawn/.await/ select/channel, cooperative cancellation, tokio-friendly embedding via engine::Engine::register_closure
  • msgpackValue::to_msgpack() / from_msgpack() via rmpv
  • obfuscate — String obfuscation via obfstr
  • rewrite — Source rewriter at [rewrite::replace_global]

Re-exports§

pub use engine::Engine;
pub use value::Value;

Modules§

ast
bytecode
Bytecode instruction set and chunk representation for the Ion VM.
compiler
AST → Bytecode compiler for the Ion VM.
engine
env
error
host_types
intern
String interner for fast variable name lookups.
interpreter
lexer
module
parser
stdlib
Built-in standard library modules.
token
value
vm
Stack-based virtual machine for executing Ion bytecode.

Derive Macros§

IonType