Skip to main content

Crate candela

Crate candela 

Source
Expand description

candela is the full toolchain: lexer, parser, type-checker, compiler, REPL, the Engine/Program embedding API, and the candela build subcommand.

The runtime core (the VM executor, bytecode/data types, GC, value marshalling, and the .cdlb load/run API) lives in the self-contained candela-vm crate. This crate depends on it (strictly candela -> candela-vm) and aliases its modules under crate:: so the compiler keeps its crate::data / crate::instr / crate::rt / crate::errors / crate::vm paths.

Re-exports§

pub use cfg::Cfg;
pub use compiler::imports::ImportResolver;
pub use compiler::compiler_data::TypeNames;

Modules§

cfg
Compile-time configuration: the names @cfg(...) tests.
compiler
macros
Macros: source regions an embedder expands.
parser

Structs§

Attribute
One attribute written on one item.
AttributeTable
Every attribute a program’s scripts wrote, with the struct and enum tables the types in it refer to.
BuildOptions
How a program is built into an artifact.
Diagnostic
A structured compile/runtime error, produced instead of printing + exiting whenever a diagnostic sink is installed (see collect_diagnostic).
Engine
The persistent embedding entry point. Holds the table of registered host functions and compiles scripts into reusable Programs.
GcStats
What the collector has done over a set of pools, and how large they are.
HostError
Why a registered host function failed.
HostRegistry
The table of Rust closures a script’s host blocks bind to.
PoolStats
How large one pool is.
Program
A compiled candela program with resident interpreter state.
RuntimeProgram
A loaded, ready-to-run program image with owned runtime state.

Enums§

AttributeTarget
The item an Attribute is written on.
AttributeValue
The value one argument of an Attribute holds.
CallError
Why a RuntimeProgram::call did not produce a value.
DataType
A resolved candela type. Attached to compiled artifacts (struct field types, dynamic-library / host function signatures) so the VM can marshal values.
HostBindError
Why a script’s host blocks could not be bound to a HostRegistry.
HostType
The type kinds that can cross the host boundary.
LoadError
Why a .cdlb artifact could not be loaded.
NativeCode
Which machine code a release build puts in the artifact.
Value
A dynamically-typed value passed across the host/script boundary.

Traits§

FromHostValue
Extracts a Rust argument from a Value for a registered host closure.
IntoHostFn
Adapts a Rust closure into a registered host function.
IntoHostResult
What a registered host closure returns: a value, or an error to raise in the script that called it.
IntoHostValue
Converts a host closure’s return value into a Value.

Functions§

base_dir
The directory set_base_dir put in effect, if any.
build_artifact
Compiles a .cdl source string to a .cdlb artifact the way options asks. build_bytecode is this with the defaults candela build uses.
build_bytecode
Compiles a .cdl source string to a .cdlb bytecode artifact.
check_only
compile_checked as a check only, which opens no library.
collect_diagnostic
Runs f with a diagnostic sink installed.
collect_warnings
Runs f and returns what it produced together with every warning raised while it ran, in the order they were raised. Nothing is printed.
compile_checked
Compiles source the way candela build does: the whole program, and then an entry point for every fully annotated function in it.
dylib_dirs
The directories set_dylib_dirs put in effect on this thread.
load_program
Loads a .cdlb bytecode artifact into a runnable RuntimeProgram.
main
The candela command. The command line itself is read in [cli].
read_attributes
Reads the attribute table out of a .cdlb without loading the program: no library is opened and no host function is bound, so a build tool or an editor lists what a program declares with nothing registered.
set_base_dir
Sets the directory a relative path resolves against, for the whole process, and returns the one that was in effect.
set_dylib_dirs
Sets the directories a dylib import’s library is looked for in on this thread, and returns the ones that were in effect, so a caller can put them back.
set_event_waker
Sets the function called whenever an event or a release is queued, and returns the one it replaces.

Type Aliases§

EventWaker
A function an embedder wants called whenever an event or a release is queued, from whichever thread queued it.