Skip to main content

Crate relon_eval_api

Crate relon_eval_api 

Source
Expand description

Public, backend-agnostic surface for Relon evaluation.

This crate is the seam between hosts and evaluator backends; it only re-exports the types a caller actually sees:

  • Data shapes: Value, Scope, Thunk, RuntimeError.
  • Host configuration surface: Context, Capabilities, NativeFnGate, native-fn / decorator registration.
  • Policy boundary: the CapabilityGate trait — single source of capability-policy truth consulted by every backend (see capability module docs for the enforcement-timing diff between dispatch-time tree-walker checks and vtable-build-time cranelift checks).
  • Backend contract: the Evaluator trait — five &self methods covering one full evaluation lifecycle.

A backend (tree-walking relon_evaluator::TreeWalkEvaluator, cranelift AOT, LLVM AOT, wasm host wrapper, …) implements this single trait; hosts then hold a Box<dyn Evaluator> for dynamic dispatch / backend swap.

Trait object-safety is a hard requirement: every method is &self plus concrete in/out types — no generic methods.

Re-exports§

pub use capability::CapabilityGate;
pub use context::Context;
pub use context::GatedNativeFn;
pub use context::LoadingModuleGuard;
pub use decorator::DecoratorPlugin;
pub use decorator::PreEvalOutcome;
pub use error::RuntimeError;
pub use module::ModuleResolver;
pub use module::ModuleSource;
pub use native_fn::EvaluatedArg;
pub use native_fn::NativeArgs;
pub use native_fn::NativeFn;
pub use native_fn::NativeFnCaps;
pub use native_fn::RelonFunction;
pub use scope::ListContext;
pub use scope::Locals;
pub use scope::RootRef;
pub use scope::Scope;
pub use scope::Thunk;
pub use scope::Thunks;
pub use smol_str::SmolStr;
pub use smol_str::SMOL_STR_INLINE_CAP;
pub use value::ClosureData;
pub use value::EnumSchemaData;
pub use value::SchemaData;
pub use value::SchemaField;
pub use value::Value;
pub use value::ValueDict;

Modules§

buffer
Typesafe writer + reader for the host <-> wasm binary handshake.
capability
Unified capability decision boundary across evaluator backends.
context
Shared evaluator context: host policy + sandbox state.
decorator
Decorator plugin protocol.
error
inplace_return
Backend-shared host side of the in-place region-walk return ABI (S1/S2 List<List<scalar>>, S3 List<String>, S4 List<Schema>, and pointer-array variant lists such as List<Enum>). When a compiled #main returns a parameter-sourced pointer-array list, the machine code does not copy the value into out_buf. Instead the epilogue reports the arena-absolute offset of the return root via the negative sentinel -(root_abs + 1). The host then:
layout
Static field-offset table for the host <-> wasm binary handshake.
module
Module resolution protocol.
native_fn
Native function interface exposed to host code.
schema_canonical
Deterministic schema serialisation + sha256 digest.
schema_lower
relon_analyzer::SchemaDef -> crate::schema_canonical::Schema conversion.
scope
Lexical and runtime context shared across evaluation steps.
smol_str
Short-string optimization (SSO) for Value::String.
value
verifier
Host-walk bounds verifier for the binary handshake buffer.

Structs§

Capabilities
Context-wide sandbox policy the host hands the evaluator. The per-bit booleans are the capabilities the host grants; per-function requirements live on NativeFnGate. A call goes through iff every bit declared on the fn’s gate is also set here — there is no per-name allowlist or global short-circuit, so a successful call proves that every bit on its gate was granted.
NativeFnGate
Capability requirements declared per native function at registration time. The gate compares these against the context-wide Capabilities grant when the function is invoked under sandbox.
ResourceBudget
Evaluator-side resource budget.

Enums§

CapabilityBit
Canonical assignment of capability bits to stable bit positions.
ResourceBudgetProfile
Evaluator-side resource-budget presets.

Traits§

Evaluator
Backend-agnostic evaluator contract.