Skip to main content

Crate htl_core

Crate htl_core 

Source
Expand description

htl: Teal, hidden.

Embeds the Teal compiler (tl.lua) into an mlua state so .tl sources can be type-checked, generated and executed without any external toolchain.

  • Htl::check / [Htl::gen]: type-check and generate Lua from a .tl file
  • Htl::install_searcher: strict require for .tl (type errors abort the require)
  • Htl::preload: register generated Lua (e.g. from include_tl!) under a module name
  • bundle: stripped-bytecode bundles produced by htl build

Re-exports§

pub use mlua;

Modules§

bundle
Stripped-bytecode bundle format (.hb).
pkg
mlua-pkg integration: a TealResolver that serves .tl modules through mlua-pkg’s Registry, so Teal sources sit in the same resolution chain as Rust-native modules, embedded Lua, vendored git deps and assets.
teal
Rust <-> Teal type bridge used by #[derive(TealRecord)] and #[host_module].
testing
htl test: discovery, one isolated Lua state per test file, compile, report.

Structs§

CheckInfo
Result of type-checking one .tl file.
Htl
An mlua state with the Teal compiler loaded.

Constants§

SKIP_DIRS
Directories never descended into when collecting sources under a root: build output, installed packages, VCS and tool state. A root passed explicitly is always walked.
TEAL_VERSION
Teal version vendored into this crate.

Functions§

collect_tl
Collect .tl sources from files and directories (sorted, recursive). Directories in SKIP_DIRS, dot-directories and the project’s package dir are not entered unless given as a root themselves.
is_skipped_dir
true for a directory entry that source collection should not enter: a name in SKIP_DIRS, any dot-directory, or the project’s mlua-pkg directory (pkgs_dir, which MLUA_PKG_DIR can move somewhere unremarkable).
is_tl_source
true for foo.tl but not foo.d.tl.
module_name
root/foo/bar.tl -> foo.bar, root/foo/init.tl -> foo.
parent_dir
Parent directory of a file, . when the path has none.
project_skip_dirs
Extra directories to skip below root: the mlua-pkg package dir when root is inside an mlua-pkg.toml project (its vendored / cached sources are dependencies, not the project’s own files).
strip_traceback
Remove a trailing Lua stack traceback: section from an error text.
user_message
A user-facing message for an error that came out of running Lua: the innermost cause without Lua’s stack traceback: block. A host function’s Err(e) surfaces as e’s own text; a Lua error("msg") surfaces as file:line: msg.
write_if_changed
Write text to path only if the content differs. Returns true when written. Used by the derive macros to emit .d.tl files without churning cargo’s fingerprints.