This crate provides a set of traits that, when implemented, comprise a complete Ruby interpreter.
alloc with an optional (enabled by default)
Interpreters implement the traits in Artichoke Core to indicate which capabilities they offer. Defining interpreters by their capabilities allows for interpreter agnostic implementations of Ruby Core and Standard Library.
Artichoke Core defines traits for the following interpreter capabilities:
DefineConstant: Define global, class, and module constants to be arbitrary Ruby
Eval: Execute Ruby source code on an interpreter from various sources.
Globals: Get, set, and unset interpreter-level global variables.
Intern: Intern bytestrings to a cheap to copy and compare symbol type.
Io: External I/O APIs, such as writing to the standard output of the current process.
LoadSources: Require source code from interpreter disk or
Parser: Manipulate the parser state, e.g. setting the current filename.
Prng: An interpreter-level pseudorandom number generator that is the backend for
ReleaseMetadata: Enable interpreters to describe themselves.
TopSelf: Access to the root execution context.
Warn: Emit warnings.
is one implementation of the
To use all of the APIs defined in Artichoke Core, bring the traits into scope by importing the prelude:
All features are enabled by default:
- std: By default,
alloc. Enabling this feature adds several trait methods that depend on
Pathas well as several implementations of
Coerce Ruby values to native numerics.
Define constants on an interpreter.
Convert between Rust and Ruby objects.
Routines for debugging and printing exception messages.
Run code on an Artichoke interpreter.
File-backed Rust extensions for the Artichoke VM.
Get and set global variables on an interpreter.
Symbols on an interpreter.
I/O read and write APIs.
Load Ruby and Rust sources into the VM.
Parse code on an Artichoke interpreter.
A “prelude” for users of the
Interpreter global psuedorandom number generator.
Regexp global state.
Information about an Artichoke build.
Expose the global context, called top self, to the interpreter.
Ruby and Rust type mappings.
Types that implement
Value can be represented in the Artichoke VM.
Emit warnings during interpreter execution.