lib.rs
raw
//! Runtime consumer of the component compiler: the IR interpreter and hot
//! reload.
//!
//! The interpreter builds the same widget tree, bindings, and event wiring
//! from IR that the proc-macro's generated code produces at compile time —
//! the differential test in the guiduck crate holds the two to identical
//! display lists. Handlers are *not* interpreted: they dispatch through the
//! generated [`DynHandlers`](guiduck_core::component::DynHandlers) registry,
//! so logic is always compiled Rust.
pub mod dev;
pub mod interpret;
pub use dev::DevMount;
/// Whether the interpreter is compiled into this build.
///
/// Always true here; the facade substitutes a stand-in module reporting false
/// when its `hot-reload` feature is off. Generated `mount` reads it, so a
/// build without the interpreter takes the compiled path rather than
/// discovering at run time that there is nothing to interpret with.
pub const AVAILABLE: bool = true;
pub use interpret::{Instantiated, instantiate, make_dyn_cx};
/// The compiler core, re-exported for callers that compile `.gdc` sources
/// themselves (the [`DevMount`] does it internally).
///
/// `compile_with_widgets` and `registry` are the pair an application needs to
/// interpret a file that writes its own widgets: build a
/// [`Registry`](guiduck_component_core::registry::Registry) with
/// [`load_widgets`](guiduck_component_core::resolve::load_widgets) over the
/// crate's `widget-path`, and compile against it — which is exactly what the
/// proc-macro does to validate the file. The widgets themselves the interpreter
/// builds from the link-time registry (`register_widget!` / `register_builtins!`).
pub use guiduck_component_core::{
ImportResolver, compile, compile_with, compile_with_widgets, component_file_name, diagnostics,
ir, registry, resolve,
};