Skip to main content

Module runtime

Module runtime 

Source
Expand description

The one construction path for a clojurust runtime.

Before this stage every layer had its own “standard environment” constructor — cljrs_runtime::interp::standard_env{,_minimal,_with_paths}, cljrs_runtime::tiered::standard_env{,_minimal,_minimal_no_ir,_with_paths}, and cljrs_stdlib::standard_env{,_no_ir,_with_paths,_with_paths_and_config}. They differed in which fn pointers they installed, whether they enabled IR lowering, and which of GC config / root tracer / source paths they remembered to set, and callers had to know which one matched their needs.

There is now one: Runtime::builder. Execution mode, source paths, GC configuration, embedded namespace sources, and tier enablement are all builder inputs. Extensions install themselves into a finished runtime — cljrs_stdlib::install(&runtime) and friends.

use cljrs_runtime::{ExecutionMode, Runtime};

let runtime = Runtime::builder()
    .execution_mode(ExecutionMode::Tiered)
    .source_paths(vec!["src".into()])
    .build()
    .expect("bootstrap");

// Extensions install into the finished runtime; this package cannot name
// them (they depend on it), so the call is shown rather than compiled:
//     cljrs_stdlib::install(&runtime);
let mut env = runtime.env("user");

Structs§

Runtime
A constructed runtime: an environment plus the execution mode that decides how its code runs.
RuntimeBuilder
Configuration for Runtime::builder.

Enums§

BuildError
Why a runtime could not be built.