Expand description
Support module referenced by #[harn_builtin]-emitted code.
The proc-macro emits paths like crate::stdlib::macros::VmBuiltinDef,
crate::stdlib::macros::BuiltinSignature, etc. This module re-exports
everything those expansions need so any harn-vm/src/stdlib/*.rs file
can apply #[harn_builtin] to a fn without extra imports.
Re-exports§
Modules§
Structs§
- Builtin
Def - A complete description of one builtin: its signature, its aliases, the
runtime handler (typed by the consumer via
H), and optional metadata. - Builtin
Signature - A complete, static description of one builtin: identifier, arity range, per-parameter types, generic type parameters, return type, and any where-clause bounds the type checker should enforce on call.
- Param
- One parameter slot inside a
BuiltinSignature. - Shape
Field Descriptor
Enums§
- Ty
const-friendly type IR used in builtin descriptors. Mirrors the runtimeTypeExprfromharn-parserbut is constructable inconstposition with no allocation. Convert toTypeExprat the boundary via the parser-sideTy::to_type_exprhelper.- VmBuiltin
Handler - Runtime handler attached to a
VmBuiltinDef.Nonecovers parser-only builtins (method-dispatched at runtime, but the parser still wants a signature for typo suggestion + return-type inference).
Constants§
- TY_ANY
- TY_BOOL
- TY_
BYTES - TY_
BYTES_ OR_ NIL bytes | nil.- TY_
CLOSURE - TY_DICT
- TY_
DICT_ OR_ NIL dict | nil.- TY_
DURATION - TY_
FLOAT - TY_INT
- TY_
INT_ OR_ NIL int | nil.- TY_LIST
- TY_
NEVER - TY_NIL
- TY_
NUMBER int | float.- TY_
STRING - TY_
STRING_ OR_ NIL string | nil.
Statics§
- ALL_
BUILTIN_ DEFS - Workspace-global registry of
#[harn_builtin]-emitted definitions. Each annotated fn contributes one entry via#[linkme::distributed_slice(ALL_BUILTIN_DEFS)], so there is no per-moduleMODULE_BUILTINSslice to maintain. The CLI / LSP / lint / serve / dap binaries force-linkharn-vmto defeat rlib dead-code stripping (linkme issue #36) so every static lands in this slice at link time.
Functions§
- register_
builtin_ defs - Eager-registration helper: install every entry (name + aliases) on
vmusing the macro-emitted handler. Each module’sregister_*_builtins(vm)calls this with itsMODULE_BUILTINSslice so the call ordering between modules stays deterministic (e.g.clockoverridesprocess::timestamp).
Type Aliases§
- Async
Builtin Future - Pinned future returned by async builtin handlers.
- Async
Handler - Async builtin handler signature. Receives an explicit
crate::vm::AsyncBuiltinCtxhandle so handlers thread the context they were given through async helper calls. - Sync
Handler - Sync builtin handler signature (matches
crate::vm::dispatch’s register_builtin shape). - VmBuiltin
Def BuiltinDefspecialized to the VM’s handler type.
Attribute Macros§
- distributed_
slice - harn_
builtin - Marks a Rust function as the runtime handler for a Harn builtin. Emits a
sibling
static <NAME>_DEF: harn_vm::stdlib::macros::VmBuiltinDef = ...containing the signature, aliases, handler pointer, and metadata.