Skip to main content

Crate rux_runtime

Crate rux_runtime 

Source
Expand description

Rux runtime, milestones M2–M9.

The document model: loads a .rux file, resolves its use component imports (loading each imported .rux), builds the script Engine (merging the main and component scripts, registering host functions), and builds the renderable tree with bindings, directives, and component expansions resolved. Running an @tap handler mutates engine state; rebuild refreshes the tree.

Document is the unit everything else works in terms of. rux-shell owns one and asks it for a tree each frame; rux check builds one and throws the tree away, which is why checking a file needs no window and no GPU and runs in CI.

Handling an event does not rebuild the document. rux-script records which signals each binding reads and which ones a handler writes, so a state change patches the nodes that the written signals actually reach and reconciles the lists that changed shape. A full rebuild is the fallback, not the path.

Two things are collected rather than printed, because the same document is loaded by a CLI, a window and a browser, and only the caller knows where output belongs. Diagnostics carries the errors and warnings a load produced; take_warnings drains the ones raised out of band. Loading a document that cannot be parsed is not a panic: it is a LoadError, so the window can keep the last good tree on screen and show the overlay instead of dying on a half-typed edit.

Structs§

Diagnostics
What is wrong with the document right now, the model behind the dev overlay.
Document
A loaded .rux document: parsed source, imported components (by tag), the script engine, and the current tree.
Focus
Which input has keyboard focus, and where its caret and selection are.
InteractionState
The interaction state the shell owns, handed to the build so pseudo-class selectors can match against it. Elements are identified by their tree path, the same child-index path the BindingRegistry uses, because that is what survives a reconcile and what the layout’s state regions report back.
LoadError
What went wrong loading a document, with the position kept when there is one.
Viewport
The viewport @media queries are evaluated against, the window’s logical size. It reaches the build the same way interaction state does, because a resize can change which rules apply, not just where boxes land.
Warning
Something the document does that will not work, with where it is if that is known.

Constants§

ROOT_PATH
Where a document starts before anything navigates.

Functions§

is_entry_point
Whether this file is a document in its own right, rather than a component meant to be used by one. None means the question could not be answered, because the file would not read or parse.
json_string
Re-exported so the shell can hand pointer/focus state and the window size in without depending on rux-style directly. Quote and escape s as a JSON string, per RFC 8259.
set_stderr_echo
Stop mirroring warnings to stderr as they are raised. Covers both sinks, so a tool that formats them itself does not have to know there are two.
take_warnings
Drain the warning sinks without building anything.