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.tlfileHtl::install_searcher: strictrequirefor.tl(type errors abort the require)Htl::preload: register generated Lua (e.g. frominclude_tl!) under a module namebundle: stripped-bytecode bundles produced byhtl build
Re-exports§
pub use mlua;
Modules§
- bundle
- Bundle format (
.hb): one program’s modules in a single file. - config
htl.toml: project-level settings shared by the CLI andinclude_tl!.- contract
---@contract/---@required: the contract a directory of modules must satisfy, declared where the type is declared.- fix
- Applying the fixes that diagnostics carry (
htl fix). - link
- Linking: the
requireclosure of one entry file, as aBundle. - pkg
- mlua-pkg integration: a
TealResolverthat serves.tlmodules through mlua-pkg’sRegistry, 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§
- Check
Info - Result of type-checking one
.tlfile. - Contract
Result - Result of a static contract check (see
Htl::contract_check). - Dependency
Error - A type error in a module a check reached through
require(seeCheckInfo::dependency_errors). - Edit
- One text replacement:
[start, end)in 1-based line / byte-column coordinates; an insertion hasend == start. - Fix
- A mechanical rewrite attached to a diagnostic (see
fix). - Function
Span - A named function of a
.tlfile, for coverage (seeHtl::coverage_spans). - Htl
- An mlua state with the Teal compiler loaded.
- Require
Site - One literal
requirecall in a checked file.
Enums§
- Applicability
- How safely a
Fixcan be applied without a human looking at it.
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
.tlsources from files and directories (sorted, recursive). Directories inSKIP_DIRS, dot-directories and the project’s package dir are not entered unless given as a root themselves. - collect_
tl_ skipping collect_tl, not enteringskipeither — directories named by path rather than by name, for what the caller knows and a name cannot say (patched_dirs).- contract_
enforcement_ lints contract-unenforcedlint: a contract only becomes a run-time guarantee when the host builds its resolver from it. Scan the host crate’s Rust sources (undercargo_root) forcontract_resolvers(. No host crate (cargo_root= None) means a script-only project: nothing to enforce.- contract_
lints contractlint for one file: whenfilesits directly under the directory a contract holds (relative toroot, the directory holdinghtl.toml), check it against that contract statically. Returns lint lines (empty when none applies).- declaration_
conflict_ lints duplicate-declarationlint: a modulefilerequires resolved to a.d.tlwhile another.d.tlfor the same module was reachable further along the search path. One was read and the other was not, decided by position, and until now nothing said so — the case this catches is a host publishing a declaration into a project that also keeps a hand-written one for the same module.- is_
declaration trueforfoo.d.tl: a declaration, with the implementation somewhere else.- is_
skipped_ dir truefor a directory entry that source collection should not enter: a name inSKIP_DIRS, any dot-directory, or one ofextra— named by path rather than by name, for what the caller knows and a name cannot say.- is_
tl_ source trueforfoo.tlbut notfoo.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. - patched_
dirs - The
patch_dirdeps belowroot: a dependency’s source taken into the tree, which the project edits and commits (htl pkg patch). - project_
skip_ dirs - Extra directories to skip below
root, whenrootis inside anmlua-pkg.tomlproject: where it installed its deps, and each copy atarget_dirdep put in the tree. - require_
cycles - Cycles in the require graph of a set of checked files, one message per cycle,
anchored at the first edge’s call site. Teal types a circular require as an opaque
circular_require, so a cycle shows up elsewhere as “cannot index” errors; naming the loop is the useful part. Files outsideinfosare treated as leaves. - 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’sErr(e)surfaces ase’s own text; a Luaerror("msg")surfaces asfile:line: msg. - write_
if_ changed - Write
texttopathonly if the content differs. Returnstruewhen written. Used by the derive macros to emit.d.tlfiles without churning cargo’s fingerprints.
Type Aliases§
- Coverage
Spans - What one parse gives a coverage report: the statement ranges, and the functions
those ranges sit in. See
Htl::coverage_spans.