PTWM
extension

ptwm_core::extension::builtins

Materialize ExtensionTableEntry values for in-tree built-ins, and the static registry that maps built-in canonical ids to their names and dispatch targets.

ptwm_core::extension::builtins

Materialize ExtensionTableEntry values for in-tree built-ins, and the static registry that maps built-in canonical ids to their names and dispatch targets.

rsmod

ptwm_core::extension::builtins

crates/ptwm-core/src/extension/builtins.rs:1
mod builtins

Materialize ExtensionTableEntry values for in-tree built-ins, and the static registry that maps built-in canonical ids to their names and dispatch targets.

rsfn

ptwm_core::extension::builtins::builtin_entries

crates/ptwm-core/src/extension/builtins.rs:235
pub fn builtin_entries() -> Vec<ExtensionTableEntry>

Every built-in Extension Table entry at the crate version.

rsfn

ptwm_core::extension::builtins::builtin_entry

crates/ptwm-core/src/extension/builtins.rs:221
pub fn builtin_entry(name: &str, kind: Kind, deterministic: bool) -> ExtensionTableEntry
rsfn

ptwm_core::extension::builtins::builtin_entry_at_version

crates/ptwm-core/src/extension/builtins.rs:243
pub fn builtin_entry_at_version(name: &str, version: &str) -> Option<ExtensionTableEntry>

The Extension Table entry of the built-in `name` with its id and label derived for `version`, as a writer of that version emits it. Returns `None` if `name` has no built-in entry or `version` fails [`is_valid_builtin_version`].

rsconst

ptwm_core::extension::builtins::BUILTIN_LABEL_PREFIX

crates/ptwm-core/src/extension/builtins.rs:30
pub const BUILTIN_LABEL_PREFIX

Prefix of every built-in label: `io.ptwm.builtin.<name>@<version>`.

rsfn

ptwm_core::extension::builtins::builtin_registry

crates/ptwm-core/src/extension/builtins.rs:176
pub fn builtin_registry() -> &BuiltinRegistry

The process-wide built-in registry, built on first use.

rstype

ptwm_core::extension::builtins::BuiltinRef

crates/ptwm-core/src/extension/builtins.rs:88
pub struct BuiltinRef

One built-in known to the registry.

rstype

ptwm_core::extension::builtins::BuiltinRegistry

crates/ptwm-core/src/extension/builtins.rs:100
pub struct BuiltinRegistry

Lookup tables over every built-in at [`CURRENT_BUILTIN_VERSION`].

rsconst

ptwm_core::extension::builtins::CURRENT_BUILTIN_VERSION

crates/ptwm-core/src/extension/builtins.rs:19
pub const CURRENT_BUILTIN_VERSION

Version that the built-in ids and labels of this build derive from.

rsfn

ptwm_core::extension::builtins::is_builtin

crates/ptwm-core/src/extension/builtins.rs:265
pub fn is_builtin(id: &CanonicalId) -> bool

Whether `id` is a built-in with an Extension Table entry at the crate version. Ids of other versions are built-in only after [`normalize_builtin_ids`] has mapped them.

rsfn

ptwm_core::extension::builtins::is_valid_builtin_version

crates/ptwm-core/src/extension/builtins.rs:276
pub fn is_valid_builtin_version(version: &str) -> bool

Whether `version` is a valid built-in version: non-empty, at most 64 bytes, and free of `@`. Every writer and [`normalize_builtin_ids`] apply this rule, so a version the reader accepts is one a writer can reproduce.

rsconst

ptwm_core::extension::builtins::LEGACY_BUILTIN_VERSION

crates/ptwm-core/src/extension/builtins.rs:27
pub const LEGACY_BUILTIN_VERSION

Version whose built-in ids and labels the legacy (`\x89PTWM`) writers stamp by default. It is fixed at the release whose reader the legacy layout exists for: a v1.1 reader recognises only the ids derived from `1.1.0`, so legacy output stays readable there whatever the crate version of the writer. Readers of every release map these ids back to the current ones (see [`normalize_builtin_ids`]).

rsconst

ptwm_core::extension::builtins::MAX_BUILTIN_VERSION_LEN

crates/ptwm-core/src/extension/builtins.rs:281
pub const MAX_BUILTIN_VERSION_LEN

Longest built-in version string, in bytes.

rsfn

ptwm_core::extension::builtins::normalize_builtin_ids

crates/ptwm-core/src/extension/builtins.rs:302
pub fn normalize_builtin_ids(table: &mut ExtensionTable) -> Option<String>

Map built-in entries written by another release to the ids and labels of the crate version.

An entry is changed only when all of these hold: - its label is `io.ptwm.builtin.<name>@<ver>`, and `<ver>` passes [`is_valid_builtin_version`]; - `<name>` has a built-in entry ([`builtin_entries`]); - its id equals `CanonicalId::derive(BUILTIN_PUBKEY, name, ver)`. Its id and label are then replaced in memory with the current ones; all other fields stay as read. Entries that fail any check (third-party entries, or an entry with a built-in label and some other id) are left untouched, so they are still treated as non-built-in. Returns the built-in version the table was written with: the first version other than the current one, or the current version if every built-in entry already has it. Returns `None` if no entry is a built-in. Writers use one version per table, so a table that mixes versions is not writer output; for such a table the result names one of them.