Skip to main content

Crate lumen_script

Crate lumen_script 

Source
Expand description

Scripting backend trait (v2) + the ScriptCommand enum scripts emit.

lumen-core does not depend on this crate. Scripts run inside host-generic systems provided by lumen-script; those systems drain the ScriptCommands the host produced this tick and forward them onto the ECS message bus for the embedder’s applier.

Concrete implementations live in runtime modules (lumen-candela and the other hosts under std/). Each provides a ScriptHost that runs whatever language it speaks, exposing the host-neutral registries (command sink, signal mirror, per-id handlers, derivations) the generic runtime drives, and registers its language through language::ScriptLanguage.

Re-exports§

pub use builtin_fns::builtin_script_fns;
pub use builtin_fns::parse_dialog_filter_spec;
pub use builtins::BuiltinFn;
pub use builtins::BuiltinParam;
pub use dnd::dispatch_drag_start_to_script;
pub use dnd::dispatch_drops_to_script;
pub use dom_events::EventHosts;
pub use dom_events::PendingDomEvents;
pub use dom_events::deliver_input_events;
pub use dom_events::deliver_state_events;
pub use dom_events::queue_pointer_and_key_events;
pub use dom_events::queue_state_events;
pub use dom_events::register_dom_event_messages;
pub use dom_events::register_event_host;
pub use http::Credentials;
pub use http::DisabledHttpClient;
pub use http::HttpClient;
pub use http::HttpDispatch;
pub use http::HttpDone;
pub use http::HttpHook;
pub use http::HttpRequest;
pub use http::HttpResponse;
pub use http::ThreadDispatch;
pub use http::UnknownCredentials;
pub use language::MarkupBlock;
pub use language::MarkupBlockError;
pub use language::ScriptCompile;
pub use language::ScriptHostAccess;
pub use language::ScriptLanguage;
pub use language::ScriptLanguageAppExt;
pub use language::ScriptLanguages;
pub use language::ScriptProgram;
pub use language::UnknownLanguage;
pub use language::install_program;
pub use script_fn::Arity0;
pub use script_fn::CallScratch;
pub use script_fn::IntoScriptFn;
pub use script_fn::MAX_VARIADIC_ARITY;
pub use script_fn::ScriptField;
pub use script_fn::ScriptFn;
pub use script_fn::ScriptFnAppExt;
pub use script_fn::ScriptFnBody;
pub use script_fn::ScriptFnBuilder;
pub use script_fn::ScriptFnCx;
pub use script_fn::ScriptFnRegistry;
pub use script_fn::ScriptFnStore;
pub use script_fn::ScriptNs;
pub use script_fn::ScriptParam;
pub use script_fn::ScriptPrelude;
pub use script_fn::ScriptResult;
pub use script_fn::ScriptRet;
pub use script_fn::ScriptSig;
pub use script_fn::ScriptStruct;
pub use script_fn::ScriptTy;
pub use script_fn::ScriptType;
pub use script_fn::with_call_scratch;
pub use wire::PluginEvent;
pub use wire::SCRIPT_WIRE_VERSION;
pub use wire::push_plugin_event;
pub use runtime::*;

Modules§

addon
Binding a browser add-on’s described functions into the hosts, on every target. Binding a browser add-on’s functions into the script hosts.
builtin_fns
The builtin surface every host shares, described once as ScriptFns. The builtin surface every script host shares, described once.
builtins
Builtin-function metadata: the shape of one entry in a host’s table.
clipboard
The applier behind the clipboard_write and clipboard_read builtins, running on whichever clipboard backend the app was assembled with. The applier behind the clipboard_write and clipboard_read builtins.
dnd
Script-facing drag-and-drop event dispatchers (on_drop / on_drag_start). See the module docs. Script-facing drag-and-drop events.
dom_events
Runtime event dispatch (phase 4): input messages -> DOM events -> propagation, one pass per event over every installed host. See dom_events::deliver_input_events. Runtime event dispatch for the dynamic DOM API (phase 4).
event
Host-neutral event object, binding registry, and propagation driver (phase 4): n.on(type, handler) / off(), the current-event cell, and the capture -> target -> bubble dispatch. Host-neutral event object, binding registry, and propagation driver for the dynamic DOM API (phase 4).
http
The HTTP seam behind fetch() / http(): the HttpClient trait and its request and response types, plus the HttpDispatch trait that decides who runs a request. lumen-http-ureq is the client Lumen ships. The HTTP seam behind the scripts’ fetch(url, tag) and http(#{...}) builtins.
introspect
Host-neutral low-level introspection read surface (phase 5): post-layout geometry, full computed style + provenance, typed component reads, tree serialization, and global runtime state. Low-level introspection read surface (design 4.7): post-layout geometry, full computed style + cascade provenance, typed component reads, tree serialization, and global runtime state.
language
Script languages as host modules register them, and the table that reaches an installed host. See language::ScriptLanguage. Script languages, as the app sees them: a registry each host fills in.
node_query
Host-neutral read side of the dynamic DOM API: query / get_by_id / traversal over the per-tick lumen_core::node::DomIndex snapshot. Host-neutral read side of the dynamic DOM API: selector queries, get_by_id, and traversal over the per-tick [DomIndex] snapshot.
runtime
Host-generic ECS driver: dispatchers, derivation fixed-point, mirror sync, timers, HTTP fetch, and runtime::ScriptPlugin. Formerly the lumen-script-runtime crate; folded in with its flat surface re-exported at the crate root for source compatibility. Host-generic script runtime.
script_fn
The host-neutral native-function description (ScriptFn) and the app-wide channel plugins register them through. One description of a native function every script host can bind.
text_parse
The parse_json and parse_markdown walks behind two of those builtins, each gated by its own Cargo feature. See the module docs. Text-to-value parsers behind the parse_json and parse_markdown builtins in crate::builtin_fns::builtin_script_fns.
unlinked
Builtins whose subsystem the running engine was linked without, and the once-per-builtin warning a call to one of them prints. Builtins whose subsystem the running engine was linked without.
wire
The encoded form of the script surface: the version the shapes below are pinned at, and the adapters for the two property-store types ScriptCommand::SetProperty carries. The encoded form of the script surface.

Structs§

CallFailure
A ScriptHost::call whose function raised an error.
CallOutcome
Outcome of one ScriptHost::call invocation.
SourceMap
The pieces of a concatenated script, in the order they were joined.

Enums§

FileDialogKind
File dialog flavour for ScriptCommand::OpenFileDialog.
ScriptCommand
One side-effect a script wants to apply to the app this tick.
ScriptError
Errors a ScriptHost can surface from load or tick.
ScriptValue
Typed sum the script-host trait understands across the boundary.

Constants§

FILE_DIALOG_BUILTINS
The builtins that open a file dialog, as the prefixes a source scan looks for: pick_file also covers pick_files and pick_file_filtered. What installs a dialog executor, and what compiles one in, both key off these.

Traits§

ScriptContext
Backend-agnostic facade exposing the reactive property store to script hosts. Mirrors QML’s QQmlContext::setContextProperty / contextProperty() shape: scripts read + write through a thin layer the host keeps internally so callers don’t have to thread an Engine or a per-backend Dynamic type through.
ScriptHost
Backend that compiles + executes scripts and exposes the host-neutral registries the generic runtime (lumen-script) drives: the command sink, the rich-typed signal mirror, the per-id handler registry, and the derivation registry.
StateProxy
Marker trait reserving the script-side state-proxy contract. Currently empty.

Functions§

carry_forward
Merge a pre-reload registry snapshot back under the entries the reloaded script just registered, so a reload never silently loses a registration.