Skip to main content

Crate ravenrs_live

Crate ravenrs_live 

Source
Expand description

An interpreter of the Rust that small RavenRS examples are written in, so they run in a playground without a compiler: let and let .. else, closures, calls and chains of builders, tuples, vec!, ranges and iterators, format!, if, match, Option, Result and ?, State and Binding::map, and the program’s own functions, constants, structs and impl blocks. The host program’s types are reached through a Registry, which #[ravenrs_live::expose] fills from the host’s own impl blocks, structs, enums and modules.

What it does not read is an error with its line and column, never a guess.

Structs§

Closure
A closure of the interpreted program, callable later by the host.
Host
An object of the host program: a component being built, a color, a binding. Builders take it by value, so using it moves it out, as in Rust; a second use is an error.
LiveError
Something wrong at a place of the program: its line and column (both from 1), how many characters it covers, and what is wrong.
Record
A value of a struct the program declares itself: its fields, which methods can change.
Registry
Everything of the host program an interpreted program can reach.

Enums§

Value
A value of the interpreted program.

Traits§

Fallback
A value the host can always fall back to when a closure it calls fails, so the failure is reported instead of stopping the program.
FromLive
What a host function’s argument can be made from.
IntoLive
What a host function’s result becomes.

Functions§

late_problems
What failed in closures the host called since the last time this was asked.
on_output
Calls watcher whenever the program prints or a closure it gave fails later, so whoever shows that can read printed and late_problems. One at a time: a new one replaces it.
printed
The lines the program printed since the last time this was asked. A line still being written, with print! and no newline yet, waits for its end.
report
Something that failed inside a closure the host called later, such as on a click: it cannot stop the program, so it is kept for whoever shows problems.
run
Runs the function entry of source, or its first function, with no arguments.

Type Aliases§

HostFn
A function of the host program, taking the interpreter’s values. For a method, the first value is the receiver.

Attribute Macros§

expose
Registers the public functions and constants of an inherent impl block, the public fields of a struct, the variants of an enum or the public functions of an inline module, behind the live feature of the crate it is used in. It generates __live_expose (or __live_expose_<part> with part = "...") on the type, or inside the module, which the crate calls when it builds its registry. skip = "a, b" leaves functions out.