[][src]Crate artichoke

Artichoke Ruby

This crate is a Rust and Ruby implementation of the Ruby programming language. Artichoke is not production-ready, but intends to be a MRI-compliant implementation of Ruby 2.6.3.

This crate provides:

Usage

You can create an interpreter and begin executing code on it:

use artichoke::prelude::*;

let mut interp = artichoke::interpreter()?;
let result = interp.eval(b"2 + 5")?;

Artichoke supports calling Ruby functions from Rust and converting between Ruby boxed values and Rust native types:

use artichoke::prelude::*;

let mut interp = artichoke::interpreter()?;
let s = interp.convert_mut("💎");
let codepoint = s.funcall(&mut interp, "ord", &[] /* args */, None /* block */)?;
let codepoint = codepoint.try_into::<u32>(&interp)?;
assert_eq!(128142, codepoint);

Crate Features

Re-exports

pub use artichoke_backend as backend;

Modules

backtrace

Format Ruby Exception backtraces.

parser

Detect if Ruby code parses successfully.

prelude

A "prelude" for users of the artichoke-backend crate.

repl

A REPL (read–eval–print–loop) for an Artichoke interpreter.

ruby

Artichoke CLI entrypoint.

Structs

Artichoke

Interpreter instance.

Exception

Functions

interpreter

Create a new Artichoke Ruby interpreter.