Skip to main content

Crate rux_script

Crate rux_script 

Source
Expand description

Rux script tier, milestone M8.

Wraps a rhai engine that holds the app’s live state (the script’s top-level let variables persist in a Scope) and evaluates {{ }} bindings, r-if/r-for expressions, and @tap handlers against it. Native capabilities are exposed under the host:: namespace via the builder.

This replaces the M5 signal reader and the M6 inline-expression evaluator with a real scripting language: named fn handlers, full expressions, and the compiled-Rust boundary (docs/04-architecture.md, script/host tiers).

Structs§

Builder
Builds an Engine: register host functions, then build with the script. Host functions must be registered before the script runs, since the script may call them during initialization.
Engine
A live script engine: state in scope, script functions in funcs.

Enums§

Nav
One navigation asked for by a script: where to go, or which way along the history that has already been walked.

Constants§

CAN_BACK_SIGNAL
Whether there is anywhere to go back to, and anywhere to go forward to. Signals rather than functions, because what they are for is disabling a button, and a button’s :class reads signals.
CAN_FORWARD_SIGNAL
PARAMS_SIGNAL
The signal holding what the matched route captured, as a map, so {{ params.id }} works anywhere and not only inside the matched view.
QUERY_SIGNAL
The signal holding the query string, parsed, as a map.
ROUTER_SIGNALS
Every name the router provides. A script declaring one of these is warned.
ROUTE_SIGNAL
The signal the router keeps the current path in. Reserved: a document that declares it is warned rather than quietly overwritten.

Functions§

parse_query
Parse a=1&b=two into pairs, undoing percent-encoding.
percent_decode
Percent-decode, treating + as a space the way a query string does.
set_routes
Tell the script tier what the document’s named routes are. Replaces the previous set, since a reload may have changed them.
set_stderr_echo
Stop (or resume) mirroring warnings to stderr.
split_query
Split a location into its path and its query string.
take_emissions
Take the events emitted since the last call, emptying the sink.
take_navigations
Take the navigations asked for since the last call, emptying the sink.
take_warnings
Take the expression failures raised since the last call, emptying the sink.
warn_script
Raise a script warning from outside the engine.