Skip to main content

Crate vibelang_rhai

Crate vibelang_rhai 

Source
Expand description

VibeLang Rhai - Scripting layer for VibeLang.

This crate provides the Rhai scripting API for VibeLang, allowing users to write .vibe scripts that define musical compositions.

§Architecture

The scripting layer works by:

  1. Executing a Rhai script that calls builder APIs (voice(), pattern(), etc.)
  2. These builders collect their configuration into a thread-local ScriptState
  3. After execution, the ScriptState is applied to the Runtime via the reload system

§Example

use vibelang_rhai::ScriptEngine;
use vibelang_core::Runtime;

let backend = /* create backend */;
let runtime = Runtime::new(backend).await?;
let mut engine = ScriptEngine::new(runtime.handle());

engine.execute_file("song.vibe").await?;

Re-exports§

pub use engine::ScriptEngine;
pub use error::Error;
pub use error::Result;
pub use api::assert::get_exit_code;
pub use api::assert::reset_exit_code;

Modules§

api
Rhai API modules.
context
Script execution context.
engine
Script engine - the main entry point for executing VibeLang scripts.
error
Error types for the scripting layer.