Crate formspec_eval

Crate formspec_eval 

Source
Expand description

Formspec Definition Evaluator — 4-phase batch processor.

§Layout

The main path is pipeline::evaluate_definition_full_with_instances_and_context:

  1. rebuild — definition → item tree, initial values, repeat expansion, wildcard binds
  2. recalculate — relevance, required, readonly, variables, calculate (recalculate())
  3. revalidate — required/type/constraint, extensions, shapes (revalidate())
  4. nrb — output shaping for non-relevant fields

Cross-cutting: convert (path resolution), private fel_json (money-aware JSON→FelValue for env fields), private runtime_seed (prePopulate / previous non-relevant). screener evaluates routes in an isolated env.

§Documentation

  • Human overview: crate README.md (phases, API map, context).
  • API reference: cargo doc -p formspec-eval --no-deps --open.
  • Markdown API export: docs/rustdoc-md/API.md (regenerate with npm run docs:formspec-eval).

Re-exports§

pub use convert::resolve_value_by_path;
pub use nrb::apply_nrb;
pub use nrb::resolve_nrb;
pub use rebuild::parse_variables;
pub use rebuild::expand_repeat_instances;
pub use rebuild::expand_wildcard_path;
pub use rebuild::rebuild_item_tree;
pub use recalculate::recalculate;
pub use recalculate::topo_sort_variables;
pub use revalidate::revalidate;
pub use screener::ScreenerRouteResult;
pub use screener::evaluate_screener;
pub use types::EvalContext;
pub use types::EvalTrigger;
pub use types::EvaluationResult;
pub use types::ExtensionConstraint;
pub use types::ItemInfo;
pub use types::NrbMode;
pub use types::ValidationResult;
pub use types::VariableDef;
pub use types::WhitespaceMode;

Modules§

convert
Value resolution helpers for dotted paths and nested objects.
nrb
Phase 4: NRB (Non-Relevant Behavior) application.
rebuild
Phase 1: Rebuild — build the item tree from a definition JSON.
recalculate
Phase 2: Recalculate — evaluate computed values and bind expressions.
revalidate
Phase 3: Revalidate — validate all constraints and shapes.
screener
Screener evaluation — evaluate screener routes and return the first matching route.
types
Core types for the Formspec evaluator.

Structs§

EvalHostContextBundle
Parsed WASM / JSON evaluation context bundle.

Functions§

eval_context_from_json_object
Parses EvalContext fields from a host JSON object (clock, prior validations, repeatCounts, …).
eval_host_context_from_json_map
Parse the optional JSON context object passed to evaluateDefinition from JavaScript.
evaluate_definition
Produce the final evaluation result. Evaluate a definition with the default continuous trigger.
evaluate_definition_full
Evaluate a definition with trigger mode and extension constraints from registries.
evaluate_definition_full_with_context
Evaluate a definition with trigger mode, extension constraints, and runtime context.
evaluate_definition_full_with_instances
Evaluate a definition with trigger mode, extension constraints, and named instances.
evaluate_definition_full_with_instances_and_context
Evaluate a definition with trigger mode, extension constraints, named instances, and runtime context.
evaluate_definition_with_context
Evaluate a definition with an explicit runtime context.
evaluate_definition_with_trigger
Evaluate a definition with an explicit trigger mode for shape timing.
evaluate_definition_with_trigger_and_context
Evaluate a definition with explicit trigger mode and runtime context.
evaluation_result_to_json_value
Full batch evaluation output as JSON (matches evaluateDefinition WASM shape, camelCase).
evaluation_result_to_json_value_styled
Serialize EvaluationResult for host bindings (JsCamel vs PythonSnake keys).
extension_constraints_from_registry_documents
Extract extension constraint payloads from raw registry documents (entries arrays).
screener_route_to_json_value
Serialize a screener route for evaluateScreener (null when no match).